victims

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomPodName

func RandomPodName(pods []corev1.Pod) string

RandomPodName picks a random pod name from a list of Pods

Types

type VictimAPICalls

type VictimAPICalls interface {
	// Exposed Api Calls
	RunningPods(kube.Interface) ([]corev1.Pod, error)
	Pods(kube.Interface) ([]corev1.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

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

func New

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

func (*VictimBase) DeletePod

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

DeletePod removes specified pod for victim

func (*VictimBase) DeleteRandomPod

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

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

func (*VictimBase) DeleteRandomPods

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

DeleteRandomPods removes specified number of random pods for the victim

func (*VictimBase) GetDeleteOptsForPod

func (v *VictimBase) GetDeleteOptsForPod() *metav1.DeleteOptions

Creates the DeleteOptions object Grace period is derived from config

func (*VictimBase) Identifier

func (v *VictimBase) Identifier() string

func (*VictimBase) IsBlacklisted

func (v *VictimBase) IsBlacklisted() bool

IsBlacklisted checks if this victim is blacklisted

func (*VictimBase) IsWhitelisted

func (v *VictimBase) IsWhitelisted() bool

IsWhitelisted checks if this victim is whitelisted

func (*VictimBase) KillNumberForFixedPercentage

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

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

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

func (v *VictimBase) Kind() string

func (*VictimBase) Mtbf

func (v *VictimBase) Mtbf() int

func (*VictimBase) Name

func (v *VictimBase) Name() string

func (*VictimBase) Namespace

func (v *VictimBase) Namespace() string

func (*VictimBase) Pods

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

Pods returns a list of pods under the victim

func (*VictimBase) RunningPods

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

RunningPods returns a list of running pods for the victim

type VictimBaseTemplate

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

	VictimAPICalls
}

type VictimKillNumberGenerator

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

type VictimSpecificAPICalls

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

Path Synopsis
Package factory is responsible for generating eligible victim kinds New types of kinds can be added easily
Package factory is responsible for generating eligible victim kinds New types of kinds can be added easily

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL