chaosmeshorg

package
v1.22.4 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

chaos-meshorg

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPodChaos_Override

func NewPodChaos_Override(p PodChaos, scope constructs.Construct, id *string, props *PodChaosProps)

Defines a "PodChaos" API object.

func PodChaos_GVK

func PodChaos_GVK() *cdk8s.GroupVersionKind

func PodChaos_IsConstruct

func PodChaos_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`.

func PodChaos_Manifest

func PodChaos_Manifest(props *PodChaosProps) interface{}

Renders a Kubernetes manifest for "PodChaos".

This can be used to inline resource manifests inside other objects (e.g. as templates).

func PodChaos_Of

func PodChaos_Of(c constructs.IConstruct) cdk8s.ApiObject

Returns the `ApiObject` named `Resource` which is a child of the given construct.

If `c` is an `ApiObject`, it is returned directly. Throws an exception if the construct does not have a child named `Default` _or_ if this child is not an `ApiObject`.

Types

type PodChaos

type PodChaos interface {
	cdk8s.ApiObject
	// The group portion of the API version (e.g. `authorization.k8s.io`).
	ApiGroup() *string
	// The object's API version (e.g. `authorization.k8s.io/v1`).
	ApiVersion() *string
	// The chart in which this object is defined.
	Chart() cdk8s.Chart
	// The object kind.
	Kind() *string
	// Metadata associated with this API object.
	Metadata() cdk8s.ApiObjectMetadataDefinition
	// The name of the API object.
	//
	// If a name is specified in `metadata.name` this will be the name returned.
	// Otherwise, a name will be generated by calling
	// `Chart.of(this).generatedObjectName(this)`, which by default uses the
	// construct path to generate a DNS-compatible name for the resource.
	Name() *string
	// The tree node.
	Node() constructs.Node
	// Create a dependency between this ApiObject and other constructs.
	//
	// These can be other ApiObjects, Charts, or custom.
	AddDependency(dependencies ...constructs.IConstruct)
	// Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object.
	//
	// Example:
	//     kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true));
	//
	AddJsonPatch(ops ...cdk8s.JsonPatch)
	// Renders the object to Kubernetes JSON.
	ToJson() interface{}
	// Returns a string representation of this construct.
	ToString() *string
}

PodChaos is the control script`s spec.

func NewPodChaos

func NewPodChaos(scope constructs.Construct, id *string, props *PodChaosProps) PodChaos

Defines a "PodChaos" API object.

type PodChaosProps

type PodChaosProps struct {
	// Spec defines the behavior of a pod chaos experiment.
	Spec     *PodChaosSpec            `field:"required" json:"spec" yaml:"spec"`
	Metadata *cdk8s.ApiObjectMetadata `field:"optional" json:"metadata" yaml:"metadata"`
}

PodChaos is the control script`s spec.

type PodChaosSpec

type PodChaosSpec struct {
	// Action defines the specific pod chaos action.
	//
	// Supported action: pod-kill / pod-failure / container-kill Default action: pod-kill.
	Action PodChaosSpecAction `field:"required" json:"action" yaml:"action"`
	// Mode defines the mode to run chaos action.
	//
	// Supported mode: one / all / fixed / fixed-percent / random-max-percent.
	Mode PodChaosSpecMode `field:"required" json:"mode" yaml:"mode"`
	// Selector is used to select pods that are used to inject chaos action.
	Selector *PodChaosSpecSelector `field:"required" json:"selector" yaml:"selector"`
	// ContainerNames indicates list of the name of affected container.
	//
	// If not set, all containers will be injected.
	ContainerNames *[]*string `field:"optional" json:"containerNames" yaml:"containerNames"`
	// Duration represents the duration of the chaos action.
	//
	// It is required when the action is `PodFailureAction`. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
	Duration *string `field:"optional" json:"duration" yaml:"duration"`
	// GracePeriod is used in pod-kill action.
	//
	// It represents the duration in seconds before the pod should be deleted. Value must be non-negative integer. The default value is zero that indicates delete immediately.
	GracePeriod *float64 `field:"optional" json:"gracePeriod" yaml:"gracePeriod"`
	// Value is required when the mode is set to `FixedPodMode` / `FixedPercentPodMod` / `RandomMaxPercentPodMod`.
	//
	// If `FixedPodMode`, provide an integer of pods to do chaos action. If `FixedPercentPodMod`, provide a number from 0-100 to specify the percent of pods the server can do chaos action. IF `RandomMaxPercentPodMod`,  provide a number from 0-100 to specify the max percent of pods to do chaos action
	Value *string `field:"optional" json:"value" yaml:"value"`
}

Spec defines the behavior of a pod chaos experiment.

type PodChaosSpecAction

type PodChaosSpecAction string

Action defines the specific pod chaos action.

Supported action: pod-kill / pod-failure / container-kill Default action: pod-kill.

const (
	// pod-kill.
	PodChaosSpecAction_POD_KILL PodChaosSpecAction = "POD_KILL"
	// pod-failure.
	PodChaosSpecAction_POD_FAILURE PodChaosSpecAction = "POD_FAILURE"
	// container-kill.
	PodChaosSpecAction_CONTAINER_KILL PodChaosSpecAction = "CONTAINER_KILL"
)

type PodChaosSpecMode

type PodChaosSpecMode string

Mode defines the mode to run chaos action.

Supported mode: one / all / fixed / fixed-percent / random-max-percent.

const (
	// one.
	PodChaosSpecMode_ONE PodChaosSpecMode = "ONE"
	// all.
	PodChaosSpecMode_ALL PodChaosSpecMode = "ALL"
	// fixed.
	PodChaosSpecMode_FIXED PodChaosSpecMode = "FIXED"
	// fixed-percent.
	PodChaosSpecMode_FIXED_PERCENT PodChaosSpecMode = "FIXED_PERCENT"
	// random-max-percent.
	PodChaosSpecMode_RANDOM_MAX_PERCENT PodChaosSpecMode = "RANDOM_MAX_PERCENT"
)

type PodChaosSpecSelector

type PodChaosSpecSelector struct {
	// Map of string keys and values that can be used to select objects.
	//
	// A selector based on annotations.
	AnnotationSelectors *map[string]*string `field:"optional" json:"annotationSelectors" yaml:"annotationSelectors"`
	// a slice of label selector expressions that can be used to select objects.
	//
	// A list of selectors based on set-based label expressions.
	ExpressionSelectors *[]*PodChaosSpecSelectorExpressionSelectors `field:"optional" json:"expressionSelectors" yaml:"expressionSelectors"`
	// Map of string keys and values that can be used to select objects.
	//
	// A selector based on fields.
	FieldSelectors *map[string]*string `field:"optional" json:"fieldSelectors" yaml:"fieldSelectors"`
	// Map of string keys and values that can be used to select objects.
	//
	// A selector based on labels.
	LabelSelectors *map[string]*string `field:"optional" json:"labelSelectors" yaml:"labelSelectors"`
	// Namespaces is a set of namespace to which objects belong.
	Namespaces *[]*string `field:"optional" json:"namespaces" yaml:"namespaces"`
	// Nodes is a set of node name and objects must belong to these nodes.
	Nodes *[]*string `field:"optional" json:"nodes" yaml:"nodes"`
	// 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.
	NodeSelectors *map[string]*string `field:"optional" json:"nodeSelectors" yaml:"nodeSelectors"`
	// PodPhaseSelectors is a set of condition of a pod at the current time.
	//
	// supported value: Pending / Running / Succeeded / Failed / Unknown.
	PodPhaseSelectors *[]*string `field:"optional" json:"podPhaseSelectors" yaml:"podPhaseSelectors"`
	// 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.
	Pods *map[string]*[]*string `field:"optional" json:"pods" yaml:"pods"`
}

Selector is used to select pods that are used to inject chaos action.

type PodChaosSpecSelectorExpressionSelectors

type PodChaosSpecSelectorExpressionSelectors struct {
	// key is the label key that the selector applies to.
	Key *string `field:"required" json:"key" yaml:"key"`
	// operator represents a key's relationship to a set of values.
	//
	// Valid operators are In, NotIn, Exists and DoesNotExist.
	Operator *string `field:"required" json:"operator" yaml:"operator"`
	// values is an array of string values.
	//
	// If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
	Values *[]*string `field:"optional" json:"values" yaml:"values"`
}

A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

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