crd

package
v1.0.22 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BandwidthSpec

type BandwidthSpec struct {
	// Rate is the speed knob. Allows bps, kbps, mbps, gbps, tbps unit. bps means bytes per second.
	Rate string `json:"rate" webhook:"Rate"`
	// Limit is the number of bytes that can be queued waiting for tokens to become available.
	// +kubebuilder:validation:Minimum=1
	Limit uint32 `json:"limit"`
	// Buffer is the maximum amount of bytes that tokens can be available for instantaneously.
	// +kubebuilder:validation:Minimum=1
	Buffer uint32 `json:"buffer"`
	// Peakrate is the maximum depletion rate of the bucket.
	// The peakrate does not need to be set, it is only necessary
	// if perfect millisecond timescale shaping is required.
	// +optional
	// +kubebuilder:validation:Minimum=0
	Peakrate *uint64 `json:"peakrate,omitempty"`
	// Minburst specifies the size of the peakrate bucket. For perfect
	// accuracy, should be set to the MTU of the interface.  If a
	// peakrate is needed, but some burstiness is acceptable, this
	// size can be raised. A 3000 byte minburst allows around 3mbit/s
	// of peakrate, given 1000 byte packets.
	// +optional
	// +kubebuilder:validation:Minimum=0
	Minburst *uint32 `json:"minburst,omitempty"`
}

BandwidthSpec defines detail of bandwidth limit.

type CorruptSpec

type CorruptSpec struct {
	Corrupt string `json:"corrupt" webhook:"FloatStr"`
	// +optional
	Correlation string `json:"correlation,omitempty" default:"0" webhook:"FloatStr"`
}

CorruptSpec defines detail of a corrupt action

type DelaySpec

type DelaySpec struct {
	Latency string `json:"latency" webhook:"Duration"`
	// +optional
	Correlation string `json:"correlation,omitempty" default:"0" webhook:"FloatStr"`
	// +optional
	Jitter string `json:"jitter,omitempty" default:"0ms" webhook:"Duration"`
	// +optional
	Reorder *ReorderSpec `json:"reorder,omitempty"`
}

DelaySpec defines detail of a delay action

type Direction

type Direction string

Direction represents traffic direction from source to target, it could be netem, delay, loss, duplicate, corrupt or partition, check comments below for detail direction flow.

const (
	// To represents network packet from source to target
	To Direction = "to"

	// From represents network packet to source from target
	From Direction = "from"

	// Both represents both directions
	Both Direction = "both"
)

type DuplicateSpec

type DuplicateSpec struct {
	Duplicate string `json:"duplicate" webhook:"FloatStr"`
	// +optional
	Correlation string `json:"correlation,omitempty" default:"0" webhook:"FloatStr"`
}

DuplicateSpec defines detail of a duplicate action

type GenericSelectorSpec

type GenericSelectorSpec struct {
	// Namespaces is a set of namespace to which objects belong.
	// +optional
	Namespaces []string `json:"namespaces,omitempty"`

	// Map of string keys and values that can be used to select objects.
	// A selector based on fields.
	// +optional
	FieldSelectors map[string]string `json:"fieldSelectors,omitempty"`

	// Map of string keys and values that can be used to select objects.
	// A selector based on labels.
	// +optional
	LabelSelectors map[string]string `json:"labelSelectors,omitempty"`

	// a slice of label selector expressions that can be used to select objects.
	// A list of selectors based on set-based label expressions.
	// +optional
	ExpressionSelectors LabelSelectorRequirements `json:"expressionSelectors,omitempty" swaggerignore:"true"`

	// Map of string keys and values that can be used to select objects.
	// A selector based on annotations.
	// +optional
	AnnotationSelectors map[string]string `json:"annotationSelectors,omitempty"`
}

GenericSelectorSpec defines some selectors to select objects.

type KafkaTopic

type KafkaTopic struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec KafkaTopicSpec `json:"spec,omitempty"`
}

CustomResource represents a custom Kubernetes resource.

type KafkaTopicSpec

type KafkaTopicSpec struct {
	Partitions int32 `json:"partitions,omitempty"`
	Replicas   int32 `json:"replicas,omitempty"`
}

KafkaTopicSpec represents the spec of the custom resource.

type LabelSelectorRequirements

type LabelSelectorRequirements []metav1.LabelSelectorRequirement

LabelSelectorRequirements is list of LabelSelectorRequirement

type LossSpec

type LossSpec struct {
	Loss string `json:"loss" webhook:"FloatStr"`
	// +optional
	Correlation string `json:"correlation,omitempty" default:"0" webhook:"FloatStr"`
}

LossSpec defines detail of a loss action

type NetworkChaos

type NetworkChaos struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec defines the behavior of a pod chaos experiment
	Spec NetworkChaosSpec `json:"spec"`
}

NetworkChaos is the Schema for the networkchaos API

type NetworkChaosAction

type NetworkChaosAction string

NetworkChaosAction represents the chaos action about network.

const (
	// NetemAction is a combination of several chaos actions i.e. delay, loss, duplicate, corrupt.
	// When using this action multiple specs are merged into one Netem RPC and sends to chaos daemon.
	NetemAction NetworkChaosAction = "netem"

	// DelayAction represents the chaos action of adding delay on pods.
	DelayAction NetworkChaosAction = "delay"

	// LossAction represents the chaos action of losing packets on pods.
	LossAction NetworkChaosAction = "loss"

	// DuplicateAction represents the chaos action of duplicating packets on pods.
	DuplicateAction NetworkChaosAction = "duplicate"

	// CorruptAction represents the chaos action of corrupting packets on pods.
	CorruptAction NetworkChaosAction = "corrupt"

	// PartitionAction represents the chaos action of network partition of pods.
	PartitionAction NetworkChaosAction = "partition"

	// BandwidthAction represents the chaos action of network bandwidth of pods.
	BandwidthAction NetworkChaosAction = "bandwidth"
)

type NetworkChaosSpec

type NetworkChaosSpec struct {
	PodSelector `json:",inline"`

	// Action defines the specific network chaos action.
	// Supported action: partition, netem, delay, loss, duplicate, corrupt
	// Default action: delay
	// +kubebuilder:validation:Enum=netem;delay;loss;duplicate;corrupt;partition;bandwidth
	Action NetworkChaosAction `json:"action"`

	// Device represents the network device to be affected.
	// +optional
	Device string `json:"device,omitempty"`

	// Duration represents the duration of the chaos action
	Duration *string `json:"duration,omitempty" webhook:"Duration"`

	// TcParameter represents the traffic control definition
	TcParameter `json:",inline"`

	// Direction represents the direction, this applies on netem and network partition action
	// +optional
	// +kubebuilder:validation:Enum=to;from;both
	// +kubebuilder:default=to
	Direction Direction `json:"direction,omitempty"`

	// Target represents network target, this applies on netem and network partition action
	// +optional
	Target *PodSelector `json:"target,omitempty" webhook:",nilable"`

	// TargetDevice represents the network device to be affected in target scope.
	// +optional
	TargetDevice string `json:"targetDevice,omitempty"`

	// ExternalTargets represents network targets outside k8s
	// +optional
	ExternalTargets []string `json:"externalTargets,omitempty"`

	// RemoteCluster represents the remote cluster where the chaos will be deployed
	// +optional
	RemoteCluster string `json:"remoteCluster,omitempty"`
}

NetworkChaosSpec defines the desired state of NetworkChaos

type PodSelector

type PodSelector struct {
	// Selector is used to select pods that are used to inject chaos action.
	Selector PodSelectorSpec `json:"selector"`

	// Mode defines the mode to run chaos action.
	// Supported mode: one / all / fixed / fixed-percent / random-max-percent
	// +kubebuilder:validation:Enum=one;all;fixed;fixed-percent;random-max-percent
	Mode SelectorMode `json:"mode"`

	// Value is required when the mode is set to `FixedMode` / `FixedPercentMode` / `RandomMaxPercentMode`.
	// If `FixedMode`, provide an integer of pods to do chaos action.
	// If `FixedPercentMode`, provide a number from 0-100 to specify the percent of pods the server can do chaos action.
	// IF `RandomMaxPercentMode`,  provide a number from 0-100 to specify the max percent of pods to do chaos action
	// +optional
	Value string `json:"value,omitempty"`
}

type PodSelectorSpec

type PodSelectorSpec struct {
	GenericSelectorSpec `json:",inline"`

	// Nodes is a set of node name and objects must belong to these nodes.
	// +optional
	Nodes []string `json:"nodes,omitempty"`

	// Pods is a map of string keys and a set values that used to select pods.
	// The key defines the namespace which pods belong,
	// and the each values is a set of pod names.
	// +optional
	Pods map[string][]string `json:"pods,omitempty"`

	// Map of string keys and values that can be used to select nodes.
	// Selector which must match a node's labels,
	// and objects must belong to these selected nodes.
	// +optional
	NodeSelectors map[string]string `json:"nodeSelectors,omitempty"`

	// PodPhaseSelectors is a set of condition of a pod at the current time.
	// supported value: Pending / Running / Succeeded / Failed / Unknown
	// +optional
	PodPhaseSelectors []string `json:"podPhaseSelectors,omitempty"`
}

PodSelectorSpec defines the some selectors to select objects. If the all selectors are empty, all objects will be used in chaos experiment.

type ReorderSpec

type ReorderSpec struct {
	Reorder string `json:"reorder" webhook:"FloatStr"`
	// +optional
	Correlation string `json:"correlation,omitempty" default:"0" webhook:"FloatStr"`
	Gap         int    `json:"gap"`
}

ReorderSpec defines details of packet reorder.

type SelectorMode

type SelectorMode string

SelectorMode represents the mode to run chaos action.

const (
	// OneMode represents that the system will do the chaos action on one object selected randomly.
	OneMode SelectorMode = "one"
	// AllMode represents that the system will do the chaos action on all objects
	// regardless of status (not ready or not running pods includes).
	// Use this label carefully.
	AllMode SelectorMode = "all"
	// FixedMode represents that the system will do the chaos action on a specific number of running objects.
	FixedMode SelectorMode = "fixed"
	// FixedPercentMode to specify a fixed % that can be inject chaos action.
	FixedPercentMode SelectorMode = "fixed-percent"
	// RandomMaxPercentMode to specify a maximum % that can be inject chaos action.
	RandomMaxPercentMode SelectorMode = "random-max-percent"
)

type TcParameter

type TcParameter struct {
	// Delay represents the detail about delay action
	// +ui:form:when=action=='delay'
	// +optional
	Delay *DelaySpec `json:"delay,omitempty"`

	// Loss represents the detail about loss action
	// +ui:form:when=action=='loss'
	// +optional
	Loss *LossSpec `json:"loss,omitempty"`

	// DuplicateSpec represents the detail about loss action
	// +ui:form:when=action=='duplicate'
	// +optional
	Duplicate *DuplicateSpec `json:"duplicate,omitempty"`

	// Corrupt represents the detail about corrupt action
	// +ui:form:when=action=='corrupt'
	// +optional
	Corrupt *CorruptSpec `json:"corrupt,omitempty"`

	// Bandwidth represents the detail about bandwidth control action
	// +ui:form:when=action=='bandwidth'
	// +optional
	Bandwidth *BandwidthSpec `json:"bandwidth,omitempty"`
}

TcParameter represents the parameters for a traffic control chaos

Jump to

Keyboard shortcuts

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