kube-monkey: github.com/asobti/kube-monkey/victims Index | Files | Directories

package victims

import "github.com/asobti/kube-monkey/victims"

Index

Package Files

victims.go

func RandomPodName Uses

func RandomPodName(pods []v1.Pod) string

RandomPodName picks a random pod name from a list of Pods

type Victim Uses

type Victim interface {
    VictimBaseTemplate
    VictimSpecificAPICalls
    VictimKillNumberGenerator
}

type VictimAPICalls Uses

type VictimAPICalls interface {
    // Exposed Api Calls
    RunningPods(kube.Interface) ([]v1.Pod, error)
    Pods(kube.Interface) ([]v1.Pod, error)
    DeletePod(kube.Interface, string) error
    DeleteRandomPod(kube.Interface) error // Deprecated, but faster than DeleteRandomPods for single pod termination
    DeleteRandomPods(kube.Interface, int) error
    IsBlacklisted() bool
    IsWhitelisted() bool
}

type VictimBase Uses

type VictimBase struct {
    VictimBaseTemplate
    // contains filtered or unexported fields
}

func New Uses

func New(kind, name, namespace, identifier string, mtbf int) *VictimBase

func (*VictimBase) DeletePod Uses

func (v *VictimBase) DeletePod(clientset kube.Interface, podName string) error

DeletePod removes specified pod for victim

func (*VictimBase) DeleteRandomPod Uses

func (v *VictimBase) DeleteRandomPod(clientset kube.Interface) error

Deprecated for DeleteRandomPods(clientset, 1) Remove a random pod for the victim

func (*VictimBase) DeleteRandomPods Uses

func (v *VictimBase) DeleteRandomPods(clientset kube.Interface, killNum int) error

DeleteRandomPods removes specified number of random pods for the victim

func (*VictimBase) GetDeleteOptsForPod Uses

func (v *VictimBase) GetDeleteOptsForPod(pod *v1.Pod) *metav1.DeleteOptions

Creates the DeleteOptions object for the pod. Grace period is calculated as the higher of configured grace period and termination grace period set on the pod

func (*VictimBase) Identifier Uses

func (v *VictimBase) Identifier() string

func (*VictimBase) IsBlacklisted Uses

func (v *VictimBase) IsBlacklisted() bool

IsBlacklisted checks if this victim is blacklisted

func (*VictimBase) IsWhitelisted Uses

func (v *VictimBase) IsWhitelisted() bool

IsWhitelisted checks if this victim is whitelisted

func (*VictimBase) KillNumberForFixedPercentage Uses

func (v *VictimBase) KillNumberForFixedPercentage(clientset kube.Interface, killPercentage int) (int, error)

KillNumberForFixedPercentage returns the number of pods to kill based on a kill percentage and the number of running pods

func (*VictimBase) KillNumberForKillingAll Uses

func (v *VictimBase) KillNumberForKillingAll(clientset kube.Interface) (int, error)

KillNumberForKillingAll returns the number of pods to kill based on the number of all running pods

func (*VictimBase) KillNumberForMaxPercentage Uses

func (v *VictimBase) KillNumberForMaxPercentage(clientset kube.Interface, maxPercentage int) (int, error)

KillNumberForMaxPercentage returns a number of pods to kill based on a a random kill percentage (between 0 and maxPercentage) and the number of running pods

func (*VictimBase) Kind Uses

func (v *VictimBase) Kind() string

func (*VictimBase) Mtbf Uses

func (v *VictimBase) Mtbf() int

func (*VictimBase) Name Uses

func (v *VictimBase) Name() string

func (*VictimBase) Namespace Uses

func (v *VictimBase) Namespace() string

func (*VictimBase) Pods Uses

func (v *VictimBase) Pods(clientset kube.Interface) ([]v1.Pod, error)

Pods returns a list of pods under the victim

func (*VictimBase) RunningPods Uses

func (v *VictimBase) RunningPods(clientset kube.Interface) (runningPods []v1.Pod, err error)

RunningPods returns a list of running pods for the victim

type VictimBaseTemplate Uses

type VictimBaseTemplate interface {
    // Get value methods
    Kind() string
    Name() string
    Namespace() string
    Identifier() string
    Mtbf() int

    VictimAPICalls
}

type VictimKillNumberGenerator Uses

type VictimKillNumberGenerator interface {
    KillNumberForMaxPercentage(kube.Interface, int) (int, error)
    KillNumberForKillingAll(kube.Interface) (int, error)
    KillNumberForFixedPercentage(kube.Interface, int) (int, error)
}

type VictimSpecificAPICalls Uses

type VictimSpecificAPICalls interface {
    // Depends on which version i.e. apps/v1 or extensions/v1beta2
    IsEnrolled(kube.Interface) (bool, error) // Get updated enroll status
    KillType(kube.Interface) (string, error) // Get updated kill config type
    KillValue(kube.Interface) (int, error)   // Get updated kill config value
}

Directories

PathSynopsis
factoryPackage factory is responsible for generating eligible victim kinds
factory/daemonsets
factory/deployments
factory/statefulsets

Package victims imports 13 packages (graph) and is imported by 5 packages. Updated 2019-11-20. Refresh now. Tools for package owners.