fault

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: AGPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Group        = "chaos-mesh.org"
	Version      = "v1alpha1"
	GroupVersion = Group + "/" + Version

	ResourcePodChaos     = "podchaos"
	ResourceNetworkChaos = "networkchaos"
	ResourceDNSChaos     = "dnschaos"
	ResourceHTTPChaos    = "httpchaos"
	ResourceIOChaos      = "iochaos"
	ResourceStressChaos  = "stresschaos"
	ResourceTimeChaos    = "timechaos"
	ResourceAWSChaos     = "awschaos"
	ResourceGCPChaos     = "gcpchaos"

	KindAWSChaos = "AWSChaos"
	KindGCPChaos = "GCPChaos"
)

GVR

View Source
const (
	CueTemplatePodChaos     = "pod_chaos_template.cue"
	CueTemplateNetworkChaos = "network_chaos_template.cue"
	CueTemplateDNSChaos     = "dns_chaos_template.cue"
	CueTemplateHTTPChaos    = "http_chaos_template.cue"
	CueTemplateIOChaos      = "io_chaos_template.cue"
	CueTemplateStressChaos  = "stress_chaos_template.cue"
	CueTemplateTimeChaos    = "time_chaos_template.cue"
	CueTemplateNodeChaos    = "node_chaos_template.cue"
)

Cue Template Name

View Source
const (
	Kill               = "kill"
	KillShort          = "kill pod"
	Failure            = "failure"
	FailureShort       = "failure pod"
	KillContainer      = "kill-container"
	KillContainerShort = "kill containers"
)

Pod Chaos Command

View Source
const (
	Partition      = "partition"
	PartitionShort = "Make a pod network partitioned from other objects."
	Loss           = "loss"
	LossShort      = "Cause pods to communicate with other objects to drop packets."
	Delay          = "delay"
	DelayShort     = "Make pods communicate with other objects lazily."
	Duplicate      = "duplicate"
	DuplicateShort = "Make pods communicate with other objects to pick up duplicate packets."
	Corrupt        = "corrupt"
	CorruptShort   = "Distorts the messages a pod communicates with other objects."
	Bandwidth      = "bandwidth"
	BandwidthShort = "Limit the bandwidth that pods use to communicate with other objects."
)

NetWork Chaos Command

View Source
const (
	Random      = "random"
	RandomShort = "Make DNS return any IP when resolving external domain names."
	Error       = "error"
	ErrorShort  = "Make DNS return an error when resolving external domain names."
)

DNS Chaos Command

View Source
const (
	Abort          = "abort"
	AbortShort     = "Abort the HTTP request and response."
	HTTPDelay      = "delay"
	HTTPDelayShort = "Delay the HTTP request and response."
	Replace        = "replace"
	ReplaceShort   = "Replace the HTTP request and response."
	Patch          = "patch"
	PatchShort     = "Patch the HTTP request and response."
)

HTTP Chaos Command

View Source
const (
	Latency        = "latency"
	LatencyShort   = "Delayed IO operations."
	Errno          = "errno"
	ErrnoShort     = "Causes IO operations to return specific errors."
	Attribute      = "attribute"
	AttributeShort = "Override the attributes of the file."
	Mistake        = "mistake"
	MistakeShort   = "Alters the contents of the file, distorting the contents of the file."
)

IO Chaos Command

View Source
const (
	Stress      = "stress"
	StressShort = "Add memory pressure or CPU load to the system."
)

Stress Chaos Command

View Source
const (
	Time      = "time"
	TimeShort = "Clock skew failure."
)

Time Chaos Command

View Source
const (
	Stop              = "stop"
	StopShort         = "Stop instance"
	Restart           = "restart"
	RestartShort      = "Restart instance"
	DetachVolume      = "detach-volume"
	DetachVolumeShort = "Detach volume"

	AWSSecretName = "cloud-key-secret-aws"
	GCPSecretName = "cloud-key-secret-gcp"
)

Node Chaos Command

View Source
const (
	Unchanged = "unchanged"
)

Unchanged DryRun flag

Variables

This section is empty.

Functions

func GetGVR

func GetGVR(group, version, resourceName string) schema.GroupVersionResource

func IsInteger

func IsInteger(str string) (bool, error)

func IsRegularMatch

func IsRegularMatch(str string) (bool, error)

func NewAbortCmd

func NewAbortCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewBandwidthCmd

func NewBandwidthCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewContainerKillCmd

func NewContainerKillCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewCorruptCmd

func NewCorruptCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewDNSChaosCmd

func NewDNSChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewDelayCmd

func NewDelayCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewDeleteCmd

func NewDeleteCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewDetachVolumeCmd

func NewDetachVolumeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewDuplicateCmd

func NewDuplicateCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewErrorCmd

func NewErrorCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewFaultCmd

func NewFaultCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewHTTPChaosCmd

func NewHTTPChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewHTTPDelayCmd

func NewHTTPDelayCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewIOAttributeOverrideCmd

func NewIOAttributeOverrideCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewIOChaosCmd

func NewIOChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewIOFaultCmd

func NewIOFaultCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewIOLatencyCmd

func NewIOLatencyCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewIOMistakeCmd

func NewIOMistakeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewListCmd

func NewListCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewLossCmd

func NewLossCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewNetworkChaosCmd

func NewNetworkChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewNodeChaosCmd

func NewNodeChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewPartitionCmd

func NewPartitionCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewPatchCmd

func NewPatchCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewPodChaosCmd

func NewPodChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewPodFailureCmd

func NewPodFailureCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewPodKillCmd

func NewPodKillCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewRandomCmd

func NewRandomCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewReplaceCmd

func NewReplaceCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewRestartCmd

func NewRestartCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewStopCmd

func NewStopCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewStressChaosCmd

func NewStressChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewTimeChaosCmd

func NewTimeChaosCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

Types

type CPU

type CPU struct {
	Workers int `json:"workers"`
	Load    int `json:"load"`
}

type DNSChaosOptions

type DNSChaosOptions struct {
	Patterns []string `json:"patterns"`

	FaultBaseOptions
}

func NewDNSChaosOptions

func NewDNSChaosOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, act string) *DNSChaosOptions

func (*DNSChaosOptions) AddCommonFlag

func (o *DNSChaosOptions) AddCommonFlag(cmd *cobra.Command)

func (*DNSChaosOptions) Complete

func (o *DNSChaosOptions) Complete() error

func (*DNSChaosOptions) NewCobraCommand

func (o *DNSChaosOptions) NewCobraCommand(use, short string) *cobra.Command

func (*DNSChaosOptions) PreCreate

func (o *DNSChaosOptions) PreCreate(obj *unstructured.Unstructured) error

func (*DNSChaosOptions) Validate

func (o *DNSChaosOptions) Validate() error

type FaultBaseOptions

type FaultBaseOptions struct {
	Action string `json:"action"`

	Mode string `json:"mode"`

	Value string `json:"value"`

	Duration string `json:"duration"`

	Selector `json:"selector"`

	action.CreateOptions `json:"-"`
}

func (*FaultBaseOptions) AddCommonFlag

func (o *FaultBaseOptions) AddCommonFlag(cmd *cobra.Command)

func (*FaultBaseOptions) BaseComplete

func (o *FaultBaseOptions) BaseComplete() error

func (*FaultBaseOptions) BaseValidate

func (o *FaultBaseOptions) BaseValidate() error

type HTTPChaosOptions

type HTTPChaosOptions struct {
	Target string `json:"target"`
	Port   int32  `json:"port"`
	Path   string `json:"path"`
	Method string `json:"method"`
	Code   int32  `json:"code,omitempty"`

	// abort command
	Abort bool `json:"abort,omitempty"`
	// delay command
	Delay string `json:"delay,omitempty"`
	// replace command
	HTTPReplace `json:"replace,omitempty"`
	// patch command
	HTTPPatch `json:"patch,omitempty"`

	FaultBaseOptions
}

func NewHTTPChaosOptions

func NewHTTPChaosOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, act string) *HTTPChaosOptions

func (*HTTPChaosOptions) AddCommonFlag

func (o *HTTPChaosOptions) AddCommonFlag(cmd *cobra.Command)

func (*HTTPChaosOptions) Complete

func (o *HTTPChaosOptions) Complete() error

func (*HTTPChaosOptions) NewCobraCommand

func (o *HTTPChaosOptions) NewCobraCommand(use, short string) *cobra.Command

func (*HTTPChaosOptions) PreCreate

func (o *HTTPChaosOptions) PreCreate(obj *unstructured.Unstructured) error

func (*HTTPChaosOptions) Validate

func (o *HTTPChaosOptions) Validate() error

type HTTPPatch

type HTTPPatch struct {
	HTTPPatchBody `json:"body,omitempty"`
}

type HTTPPatchBody

type HTTPPatchBody struct {
	PatchBodyValue string `json:"value,omitempty"`
	PatchBodyType  string `json:"type,omitempty"`
}

type HTTPReplace

type HTTPReplace struct {
	ReplaceBody      []byte `json:"body,omitempty"`
	InputReplaceBody string `json:"-"`
	ReplacePath      string `json:"path,omitempty"`
	ReplaceMethod    string `json:"method,omitempty"`
}

type IOAttribute

type IOAttribute struct {
	Ino    uint64 `json:"ino,omitempty"`
	Size   uint64 `json:"size,omitempty"`
	Blocks uint64 `json:"blocks,omitempty"`
	Perm   uint16 `json:"perm,omitempty"`
	Nlink  uint32 `json:"nlink,omitempty"`
	UID    uint32 `json:"uid,omitempty"`
	GID    uint32 `json:"gid,omitempty"`
}

type IOChaosOptions

type IOChaosOptions struct {
	// Parameters required by the `latency` command.
	Delay string `json:"delay"`

	// Parameters required by the `fault` command.
	Errno int `json:"errno"`

	// Parameters required by the `attribute` command.
	IOAttribute `json:"attr,omitempty"`

	// Parameters required by the `mistake` command.
	IOMistake `json:"mistake,omitempty"`

	VolumePath     string   `json:"volumePath"`
	Path           string   `json:"path"`
	Percent        int      `json:"percent"`
	Methods        []string `json:"methods,omitempty"`
	ContainerNames []string `json:"containerNames,omitempty"`

	FaultBaseOptions
}

func NewIOChaosOptions

func NewIOChaosOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, act string) *IOChaosOptions

func (*IOChaosOptions) AddCommonFlag

func (o *IOChaosOptions) AddCommonFlag(cmd *cobra.Command, f cmdutil.Factory)

func (*IOChaosOptions) Complete

func (o *IOChaosOptions) Complete() error

func (*IOChaosOptions) NewCobraCommand

func (o *IOChaosOptions) NewCobraCommand(use, short string) *cobra.Command

func (*IOChaosOptions) PreCreate

func (o *IOChaosOptions) PreCreate(obj *unstructured.Unstructured) error

func (*IOChaosOptions) Validate

func (o *IOChaosOptions) Validate() error

type IOMistake

type IOMistake struct {
	Filling        string `json:"filling,omitempty"`
	MaxOccurrences int    `json:"maxOccurrences,omitempty"`
	MaxLength      int    `json:"maxLength,omitempty"`
}

type ListAndDeleteOptions

type ListAndDeleteOptions struct {
	Factory cmdutil.Factory
	Dynamic dynamic.Interface

	ResourceKinds    []string
	AllResourceKinds []string
	Kind             bool

	genericiooptions.IOStreams
}

func (*ListAndDeleteOptions) Complete

func (o *ListAndDeleteOptions) Complete(args []string) error

func (*ListAndDeleteOptions) RunDelete

func (o *ListAndDeleteOptions) RunDelete() error

func (*ListAndDeleteOptions) RunList

func (o *ListAndDeleteOptions) RunList() error

func (*ListAndDeleteOptions) Validate

func (o *ListAndDeleteOptions) Validate(args []string) error

type Memory

type Memory struct {
	Workers int    `json:"workers"`
	Size    string `json:"size"`
}

type NetworkBandwidth

type NetworkBandwidth struct {
	// the rate at which the bandwidth is limited.
	Rate string `json:"rate,omitempty"`
	// the number of bytes waiting in the queue.
	Limit uint32 `json:"limit,omitempty"`
	// the maximum number of bytes that can be sent instantaneously.
	Buffer uint32 `json:"buffer,omitempty"`
	// the bucket's maximum consumption rate. Reference: https://man7.org/linux/man-pages/man8/tc-tbf.8.html.
	Peakrate uint64 `json:"peakrate,omitempty"`
	// the size of the peakrate bucket. Reference: https://man7.org/linux/man-pages/man8/tc-tbf.8.html.
	Minburst uint32 `json:"minburst,omitempty"`
}

NetworkBandwidth Bandwidth command

type NetworkChaosOptions

type NetworkChaosOptions struct {
	// Specify the network direction
	Direction string `json:"direction"`

	// A network target outside of Kubernetes, which can be an IPv4 address or a domain name,
	// such as "kubeblocks.io". Only works with direction: to.
	ExternalTargets []string `json:"externalTargets,omitempty"`

	// A collection of target pods. Pods can be selected by namespace and label.
	Target `json:"target,omitempty"`

	NetworkLoss `json:"loss,omitempty"`

	NetworkDelay `json:"delay,omitempty"`

	NetworkDuplicate `json:"duplicate,omitempty"`

	NetworkCorrupt `json:"corrupt,omitempty"`

	NetworkBandwidth `json:"bandwidth,omitempty"`

	FaultBaseOptions
}

func NewNetworkChaosOptions

func NewNetworkChaosOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, act string) *NetworkChaosOptions

func (*NetworkChaosOptions) AddCommonFlag

func (o *NetworkChaosOptions) AddCommonFlag(cmd *cobra.Command)

func (*NetworkChaosOptions) Complete

func (o *NetworkChaosOptions) Complete() error

func (*NetworkChaosOptions) NewCobraCommand

func (o *NetworkChaosOptions) NewCobraCommand(use, short string) *cobra.Command

func (*NetworkChaosOptions) PreCreate

func (*NetworkChaosOptions) Validate

func (o *NetworkChaosOptions) Validate() error

type NetworkCorrupt

type NetworkCorrupt struct {
	// The percentage of packet corruption
	Corrupt string `json:"corrupt,omitempty"`
	// The correlation of loss or corruption or duplication or delay
	Correlation string `json:"correlation,omitempty"`
}

NetworkCorrupt Corrupt command

type NetworkDelay

type NetworkDelay struct {
	// The latency of delay
	Latency string `json:"latency,omitempty"`
	// The jitter of delay
	Jitter string `json:"jitter,omitempty"`
	// The correlation of loss or corruption or duplication or delay
	Correlation string `json:"correlation,omitempty"`
}

NetworkDelay Delay command

type NetworkDuplicate

type NetworkDuplicate struct {
	// The percentage of packet duplication
	Duplicate string `json:"duplicate,omitempty"`
	// The correlation of loss or corruption or duplication or delay
	Correlation string `json:"correlation,omitempty"`
}

NetworkDuplicate Duplicate command

type NetworkLoss

type NetworkLoss struct {
	// The percentage of packet loss
	Loss string `json:"loss,omitempty"`
	// The correlation of loss or corruption or duplication or delay
	Correlation string `json:"correlation,omitempty"`
}

NetworkLoss Loss command

type NodeChaoOptions

type NodeChaoOptions struct {
	Kind string `json:"kind"`

	Action string `json:"action"`

	CloudProvider string `json:"-"`

	SecretName string `json:"secretName"`

	Region string `json:"region"`

	Instance string `json:"instance"`

	VolumeID  string   `json:"volumeID"`
	VolumeIDs []string `json:"-"`

	DeviceName  string   `json:"deviceName,omitempty"`
	DeviceNames []string `json:"-"`

	Project string `json:"project"`

	Duration string `json:"duration"`

	AutoApprove bool `json:"-"`

	action.CreateOptions `json:"-"`
}

func (*NodeChaoOptions) AddCommonFlag

func (o *NodeChaoOptions) AddCommonFlag(cmd *cobra.Command)

func (*NodeChaoOptions) Complete

func (o *NodeChaoOptions) Complete(action string) error

func (*NodeChaoOptions) CreateSecret

func (o *NodeChaoOptions) CreateSecret(testEnv bool) error

func (*NodeChaoOptions) Execute

func (o *NodeChaoOptions) Execute(action string, args []string, testEnv bool) error

func (*NodeChaoOptions) NewCobraCommand

func (o *NodeChaoOptions) NewCobraCommand(use, short string) *cobra.Command

func (*NodeChaoOptions) PreCreate

func (o *NodeChaoOptions) PreCreate(obj *unstructured.Unstructured) error

func (*NodeChaoOptions) Validate

func (o *NodeChaoOptions) Validate() error

type PodChaosOptions

type PodChaosOptions struct {
	// GracePeriod waiting time, after which fault injection is performed
	GracePeriod    int64    `json:"gracePeriod"`
	ContainerNames []string `json:"containerNames,omitempty"`

	FaultBaseOptions
}

func NewPodChaosOptions

func NewPodChaosOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, act string) *PodChaosOptions

func (*PodChaosOptions) AddCommonFlag

func (o *PodChaosOptions) AddCommonFlag(cmd *cobra.Command)

func (*PodChaosOptions) Complete

func (o *PodChaosOptions) Complete() error

func (*PodChaosOptions) NewCobraCommand

func (o *PodChaosOptions) NewCobraCommand(use, short string) *cobra.Command

func (*PodChaosOptions) PreCreate

func (o *PodChaosOptions) PreCreate(obj *unstructured.Unstructured) error

func (*PodChaosOptions) Validate

func (o *PodChaosOptions) Validate() error

type Selector

type Selector struct {
	PodNameSelectors map[string][]string `json:"pods"`

	NamespaceSelectors []string `json:"namespaces"`

	LabelSelectors map[string]string `json:"labelSelectors"`

	PodPhaseSelectors []string `json:"podPhaseSelectors"`

	NodeLabelSelectors map[string]string `json:"nodeSelectors"`

	AnnotationSelectors map[string]string `json:"annotationSelectors"`

	NodeNameSelectors []string `json:"nodes"`
}

type StressChaosOptions

type StressChaosOptions struct {
	Stressors      `json:"stressors"`
	ContainerNames []string `json:"containerNames,omitempty"`

	FaultBaseOptions
}

func NewStressChaosOptions

func NewStressChaosOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, act string) *StressChaosOptions

func (*StressChaosOptions) AddCommonFlag

func (o *StressChaosOptions) AddCommonFlag(cmd *cobra.Command, f cmdutil.Factory)

func (*StressChaosOptions) Complete

func (o *StressChaosOptions) Complete() error

func (*StressChaosOptions) NewCobraCommand

func (o *StressChaosOptions) NewCobraCommand(use, short string) *cobra.Command

func (*StressChaosOptions) PreCreate

func (*StressChaosOptions) Validate

func (o *StressChaosOptions) Validate() error

type Stressors

type Stressors struct {
	CPU    `json:"cpu"`
	Memory `json:"memory"`
}

type Target

type Target struct {
	TargetMode     string `json:"mode,omitempty"`
	TargetValue    string `json:"value,omitempty"`
	TargetSelector `json:"selector,omitempty"`
}

type TargetSelector

type TargetSelector struct {
	// Specifies the labels that target Pods come with.
	TargetLabelSelectors map[string]string `json:"labelSelectors,omitempty"`
	// Specifies the namespaces to which target Pods belong.
	TargetNamespaceSelectors []string `json:"namespaces,omitempty"`
}

type TimeChaosOptions

type TimeChaosOptions struct {
	TimeOffset string `json:"timeOffset"`

	ClockIds []string `json:"clockIds,omitempty"`

	ContainerNames []string `json:"containerNames,omitempty"`

	FaultBaseOptions
}

func NewTimeChaosOptions

func NewTimeChaosOptions(f cmdutil.Factory, streams genericiooptions.IOStreams, act string) *TimeChaosOptions

func (*TimeChaosOptions) AddCommonFlag

func (o *TimeChaosOptions) AddCommonFlag(cmd *cobra.Command, f cmdutil.Factory)

func (*TimeChaosOptions) Complete

func (o *TimeChaosOptions) Complete() error

func (*TimeChaosOptions) NewCobraCommand

func (o *TimeChaosOptions) NewCobraCommand(use, short string) *cobra.Command

func (*TimeChaosOptions) PreCreate

func (o *TimeChaosOptions) PreCreate(obj *unstructured.Unstructured) error

func (*TimeChaosOptions) Validate

func (o *TimeChaosOptions) Validate() error

Jump to

Keyboard shortcuts

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