Define the Scope of Chaos Experiment
This document describes how to define the scope of a chaos experiment.
Chaos Mesh provides a variety of selectors, which you can use to define the scope of your chaos experiment. These selectors are defined in the spec.selector
field of the chaos object.
#
Namespace selectorsNamespace selectors filter the chaos experiment targets by the namespace. Defined as a set of strings. The default namespace selector for Chaos Mesh is the chaos experiment object. For example:
#
Label selectorsLabel selectors filter chaos experiment targets by the label. Defined as a map of string keys and values. For example:
#
Annotation selectorsAnnotation selectors filter chaos experiment targets by the annotation. Defined as a map of string keys and values. For example:
#
Field selectorsField selectors filter chaos experiment targets by the resource field. Defined as a map of string keys and values. For example:
For more details about field selectors, refer to the Kubernetes document.
#
Pod phase selectorsPod Phase selectors filter chaos experiment targets by the condition. Defined as a set of string. Supported conditions: Pending
, Running
, Succeeded
, Failed
, Unknown
. For example:
#
Pod selectorsPod selectors filter chaos experiment targets by the pod. Defined as a map of string keys and values. The key in this map specifies the namespace which the pods belong to, and each value under the key is a pod. If this selector is not empty, these pod defined in this map are used directly and other defined selectors will be ignored. For example: