chaosmesh

package
v0.0.0-...-f5de34e Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnoPodSelectorMode        = "selector.chaos-mesh.org/mode"
	AnnoPodSelectorValue       = "selector.chaos-mesh.org/value"
	AnnoTargetPodSelectorMode  = "target-selector.chaos-mesh.org/mode"
	AnnoTargetPodSelectorValue = "target-selector.chaos-mesh.org/value"

	AnnoStressTime        = "stresschaos.chaos-mesh.org/time"
	AnnoStressOOMScoreAdj = "stresschaos.chaos-mesh.org/oomScoreAdj"

	AnnoNetworkAction            = "networkchaos.chaos-mesh.org/action"
	AnnoNetworkDevice            = "networkchaos.chaos-mesh.org/device"
	AnnoNetworkTargetDevice      = "networkchaos.chaos-mesh.org/targetDevice"
	AnnoNetworkBandwidthRate     = "networkchaos.chaos-mesh.org/bandwidth:rate"
	AnnoNetworkBandwidthLimit    = "networkchaos.chaos-mesh.org/bandwidth:limit"
	AnnoNetworkBandwidthBuffer   = "networkchaos.chaos-mesh.org/bandwidth:buffer"
	AnnoNetworkBandwidthPeakrate = "networkchaos.chaos-mesh.org/bandwidth:peakrate"
	AnnoNetworkBandwidthMinBurst = "networkchaos.chaos-mesh.org/bandwidth:minburst"
)

Variables

View Source
var (
	ErrConvert     = errors.New("can not convert chaos interface to specify struct")
	ErrNotChanged  = errors.New("object not changed")
	ErrChangedSpec = errors.New("change spec")
)

Functions

func ConvertChaosStatus

func ConvertChaosStatus(ctx context.Context, ssChaos *v1alpha1.Chaos, chaos GenericChaos) v1alpha1.ChaosCondition

func DefaultNetworkChaos

func DefaultNetworkChaos() *chaosmeshv1alpha1.NetworkChaos

func DefaultPodChaos

func DefaultPodChaos() *chaosmeshv1alpha1.PodChaos

Types

type BandWidthActionBuilder

type BandWidthActionBuilder interface {
	SetRate(string) BandWidthActionBuilder
	SetLimit(string) BandWidthActionBuilder
	SetBuffer(string) BandWidthActionBuilder
	SetPeakRate(string) BandWidthActionBuilder
	SetMinBurst(string) BandWidthActionBuilder
	Build() *chaosmeshv1alpha1.BandwidthSpec
}

func NewBandWidthActionBuilder

func NewBandWidthActionBuilder() BandWidthActionBuilder

type Builder

type Builder interface {
	NewPodChaos(context.Context, *v1alpha1.Chaos) PodChaos
	NewNetworkChaos(context.Context, *v1alpha1.Chaos) NetworkChaos
	NewStressChaos(context.Context, *v1alpha1.Chaos) StressChaos
}

Builder build Chaos from different parameters

type Chaos

type Chaos interface {
	Builder
	Getter
	Setter
}

Chaos interface contains setter and getter

func NewChaos

func NewChaos(client client.Client) Chaos

NewChaos creates a new Chaos

type GenericChaos

type GenericChaos interface{}

type Getter

type Getter interface {
	GetPodChaosByNamespacedName(context.Context, types.NamespacedName) (PodChaos, error)
	GetNetworkChaosByNamespacedName(context.Context, types.NamespacedName) (NetworkChaos, error)
	GetStressChaosByNamespacedName(context.Context, types.NamespacedName) (StressChaos, error)
}

Getter get Chaos from different parameters

type NetworkChaos

type NetworkChaos interface{}

func NewNetworkChaos

func NewNetworkChaos(ssChao *v1alpha1.Chaos) (NetworkChaos, error)

type PodChaos

type PodChaos interface{}

func NewPodChaos

func NewPodChaos(ssChao *v1alpha1.Chaos) (PodChaos, error)

type PodChaosBuilder

type PodChaosBuilder interface {
	SetName(string) PodChaosBuilder
	SetNamespace(string) PodChaosBuilder
	SetLabels(map[string]string) PodChaosBuilder
	SetAnnotations(map[string]string) PodChaosBuilder

	SetContainerSelector(*chaosmeshv1alpha1.ContainerSelector) PodChaosBuilder
	SetAction(string) PodChaosBuilder
	SetDuration(*string) PodChaosBuilder
	SetGracePeriod(int64) PodChaosBuilder
	Build() *chaosmeshv1alpha1.PodChaos
}

func NewPodChaosBuilder

func NewPodChaosBuilder() PodChaosBuilder

type PodSelectorBuilder

type PodSelectorBuilder interface {
	// PodSelector
	SetSelectMode(string) PodSelectorBuilder
	SetValue(string) PodSelectorBuilder

	// PodSelectorSpec
	SetNodes([]string) PodSelectorBuilder
	SetPods(map[string][]string) PodSelectorBuilder
	SetNodeSelector(map[string]string) PodSelectorBuilder
	SetPodPhaseSelectors([]string) PodSelectorBuilder

	// GenericSelectorSpec
	SetNamespaces([]string) PodSelectorBuilder
	SetFieldSelectors(map[string]string) PodSelectorBuilder
	SetLabelSelector(map[string]string) PodSelectorBuilder
	SetExpressionSelectors([]metav1.LabelSelectorRequirement) PodSelectorBuilder
	SetAnnotationSelectors(map[string]string) PodSelectorBuilder

	Build() *chaosmeshv1alpha1.PodSelector
}

func NewPodSelectorBuilder

func NewPodSelectorBuilder() PodSelectorBuilder

type Setter

type Setter interface {
	CreatePodChaos(context.Context, *v1alpha1.Chaos) error
	UpdatePodChaos(context.Context, PodChaos, *v1alpha1.Chaos) error
	DeletePodChaos(context.Context, PodChaos) error

	CreateNetworkChaos(context.Context, *v1alpha1.Chaos) error
	UpdateNetworkChaos(context.Context, NetworkChaos, *v1alpha1.Chaos) error
	DeleteNetworkChaos(context.Context, NetworkChaos) error

	CreateStressChaos(context.Context, *v1alpha1.Chaos) error
	UpdateStressChaos(context.Context, StressChaos, *v1alpha1.Chaos) error
	DeleteStressChaos(context.Context, StressChaos) error
}

Setter set Chaos from different parameters

type StressChaos

type StressChaos interface{}

func NewStressChaos

func NewStressChaos(chaos *v1alpha1.Chaos) (StressChaos, error)

Directories

Path Synopsis
Package mock_chaosmesh is a generated GoMock package.
Package mock_chaosmesh is a generated GoMock package.

Jump to

Keyboard shortcuts

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