Documentation ¶
Index ¶
- Constants
- Variables
- func CheckFlags(flags map[string]string) *spec.Response
- func CheckPodFlags(flags map[string]string) *spec.Response
- func CreateDestroyedStatus(oldExpStatus v1alpha1.ExperimentStatus) v1alpha1.ExperimentStatus
- func ExcludeKeyFunc() func() map[string]spec.Empty
- func ExtractExpModelFromExperimentSpec(experimentSpec v1alpha1.ExperimentSpec) *spec.ExpModel
- func GetChaosBladeDaemonsetPodName(nodeName string, client *channel.Client) (string, error)
- func GetChaosBladeFlags() []spec.ExpFlagSpec
- func GetContainerFlags() []spec.ExpFlagSpec
- func GetExperimentIdFromContext(ctx context.Context) string
- func GetNetworkFlags() []spec.ExpFlagSpec
- func GetOneAvailableContainerIdFromPod(pod v1.Pod) (containerId, containerName, runtime string, err error)
- func GetResourceCommonFlags() []spec.ExpFlagSpec
- func GetResourceCount(resourceCount int, flags map[string]string) (int, *spec.Response)
- func GetResourceCoverageFlags() []spec.ExpFlagSpec
- func GetResourceFlagNames() map[string]spec.Empty
- func MapContains(bigMap map[string]string, requirements []pkglabels.Requirement) bool
- func ParallelizeExec(workCount int, doWork DoWorkFunc)
- func ParseLabels(labels string) []pkglabels.Requirement
- func SetContainerObjectMetaListToContext(ctx context.Context, containerMatchedList ContainerMatchedList) context.Context
- func SetExperimentIdToContext(ctx context.Context, experimentId string) context.Context
- func TruncateContainerObjectMetaUid(uid string) (containerRuntime, containerId string)
- type BaseExperimentController
- func (b *BaseExperimentController) Destroy(ctx context.Context, expSpec v1alpha1.ExperimentSpec) *spec.Response
- func (b *BaseExperimentController) Exec(ctx context.Context, expModel *spec.ExpModel) *spec.Response
- func (b *BaseExperimentController) GetMatchedPodResources(ctx context.Context, expModel spec.ExpModel) ([]v1.Pod, *spec.Response)
- type BaseResourceExpModelSpec
- func (b *BaseResourceExpModelSpec) ExpModels() map[string]spec.ExpModelCommandSpec
- func (b *BaseResourceExpModelSpec) GetExpActionModelSpec(target, actionName string) spec.ExpActionCommandSpec
- func (b *BaseResourceExpModelSpec) RegisterExpModels(expModel ...spec.ExpModelCommandSpec)
- func (b *BaseResourceExpModelSpec) Scope() string
- type BaseSubResourceExpModelSpec
- type CommonExecutor
- type ContainerMatchedList
- type ContainerObjectMeta
- type CopyOptions
- type DeployMode
- type DeployOptions
- type DoWorkFunc
- type DownloadOptions
- type ExecCommandInPodExecutor
- type ExpController
- type ExperimentController
- type ExperimentIdentifierInPod
- type OSSubResourceModelSpec
- type ResourceExpModelSpec
- type SubResourceExpModelSpec
Constants ¶
const CategorySystemContainer = "system_container"
const ContainerObjectMetaListKey = "ContainerObjectMetaListKey"
const DefaultNamespace = "default"
const ExperimentIdKey = "ExperimentIdKey"
Variables ¶
var ChaosBladeDeployModeFlag = &spec.ExpFlag{
Name: "chaosblade-deploy-mode",
Desc: "The mode of chaosblade deployment in container, the values are copy and download, the default value is copy which copy tool from the operator to the target container. If you select download mode, the operator will download chaosblade tool from the chaosblade-download-url.",
}
var ChaosBladeDownloadUrlFlag = &spec.ExpFlag{
Name: "chaosblade-download-url",
Desc: "The chaosblade downloaded address. If you use download deployment mode, you must specify the value, or config chaosblade-download-url when deploying the operator",
}
var ChaosBladePathFlag = &spec.ExpFlag{
Name: "chaosblade-path",
Desc: "Chaosblade tool deployment path, default value is /opt. Please select a path with write permission",
}
var ContainerIdsFlag = &spec.ExpFlag{ Name: "container-ids", Desc: "Container ids", NoArgs: false, Required: false, }
var ContainerIndexFlag = &spec.ExpFlag{
Name: "container-index",
Desc: "Container index, start from 0",
}
var ContainerNamesFlag = &spec.ExpFlag{ Name: "container-names", Desc: "Container names", NoArgs: false, Required: false, }
var CopyMode = "copy"
var DownloadMode = "download"
var IsDockerNetworkFlag = &spec.ExpFlag{ Name: "is-docker-network", Desc: "Used when a docker container is used and there is no tc command in the target container. Just for docker command, Deprecated! Please use use-sidecar-container-network flag.", NoArgs: true, Required: false, }
var ResourceCountFlag = &spec.ExpFlag{ Name: "evict-count", Desc: "Count of affected resource", NoArgs: false, Required: false, }
var ResourceGroupKeyFlag = &spec.ExpFlag{ Name: "evict-group", Desc: "Group key from labels", NoArgs: false, Required: false, }
var ResourceLabelsFlag = &spec.ExpFlag{ Name: "labels", Desc: "Label selector, the relationship between values that are or", NoArgs: false, Required: false, }
var ResourceNamesFlag = &spec.ExpFlag{ Name: "names", Desc: "Resource names, such as pod name. You must add namespace flag for it. Multiple parameters are separated directly by commas", NoArgs: false, Required: false, }
var ResourceNamespaceFlag = &spec.ExpFlag{ Name: "namespace", Desc: "Namespace, such as default, only one value can be specified", NoArgs: false, Required: true, }
var ResourcePercentFlag = &spec.ExpFlag{ Name: "evict-percent", Desc: "Percent of affected resource, integer value without %", NoArgs: false, Required: false, }
var UseSidecarContainerNetworkFlag = &spec.ExpFlag{ Name: "use-sidecar-container-network", Desc: "When there is no tc command in the target container. Set the sidecar container network true.", NoArgs: true, Required: false, }
Functions ¶
func CreateDestroyedStatus ¶
func CreateDestroyedStatus(oldExpStatus v1alpha1.ExperimentStatus) v1alpha1.ExperimentStatus
CreateDestroyedStatus returns the ExperimentStatus with destroyed state
func ExcludeKeyFunc ¶
func ExtractExpModelFromExperimentSpec ¶
func ExtractExpModelFromExperimentSpec(experimentSpec v1alpha1.ExperimentSpec) *spec.ExpModel
ExtractExpModelFromExperimentSpec convert ExperimentSpec to ExpModel
func GetChaosBladeDaemonsetPodName ¶ added in v1.6.0
GetChaosBladeDaemonsetPodName
func GetChaosBladeFlags ¶ added in v0.7.0
func GetChaosBladeFlags() []spec.ExpFlagSpec
func GetContainerFlags ¶
func GetContainerFlags() []spec.ExpFlagSpec
func GetExperimentIdFromContext ¶ added in v0.7.0
GetExperimentIdFromContext
func GetNetworkFlags ¶ added in v1.4.0
func GetNetworkFlags() []spec.ExpFlagSpec
func GetResourceCommonFlags ¶
func GetResourceCommonFlags() []spec.ExpFlagSpec
func GetResourceCount ¶
func GetResourceCoverageFlags ¶
func GetResourceCoverageFlags() []spec.ExpFlagSpec
func GetResourceFlagNames ¶
func MapContains ¶ added in v0.8.0
func MapContains(bigMap map[string]string, requirements []pkglabels.Requirement) bool
func ParallelizeExec ¶ added in v1.2.0
func ParallelizeExec(workCount int, doWork DoWorkFunc)
func ParseLabels ¶ added in v0.8.0
func ParseLabels(labels string) []pkglabels.Requirement
func SetContainerObjectMetaListToContext ¶ added in v0.7.0
func SetContainerObjectMetaListToContext(ctx context.Context, containerMatchedList ContainerMatchedList) context.Context
SetContainerObjectMetaListToContext
func SetExperimentIdToContext ¶ added in v0.7.0
SetExperimentIdToContext
Types ¶
type BaseExperimentController ¶
type BaseExperimentController struct { Client *channel.Client ResourceModelSpec ResourceExpModelSpec }
func (*BaseExperimentController) Destroy ¶
func (b *BaseExperimentController) Destroy(ctx context.Context, expSpec v1alpha1.ExperimentSpec) *spec.Response
type BaseResourceExpModelSpec ¶
type BaseResourceExpModelSpec struct { ScopeName string Client *channel.Client ExpModelSpecs map[string]spec.ExpModelCommandSpec }
func NewBaseResourceExpModelSpec ¶
func NewBaseResourceExpModelSpec(scopeName string, client *channel.Client) BaseResourceExpModelSpec
func (*BaseResourceExpModelSpec) ExpModels ¶
func (b *BaseResourceExpModelSpec) ExpModels() map[string]spec.ExpModelCommandSpec
func (*BaseResourceExpModelSpec) GetExpActionModelSpec ¶
func (b *BaseResourceExpModelSpec) GetExpActionModelSpec(target, actionName string) spec.ExpActionCommandSpec
func (*BaseResourceExpModelSpec) RegisterExpModels ¶
func (b *BaseResourceExpModelSpec) RegisterExpModels(expModel ...spec.ExpModelCommandSpec)
func (*BaseResourceExpModelSpec) Scope ¶
func (b *BaseResourceExpModelSpec) Scope() string
type BaseSubResourceExpModelSpec ¶
type BaseSubResourceExpModelSpec struct { ExpModelSpecs []spec.ExpModelCommandSpec ExpExecutor spec.Executor }
func (*BaseSubResourceExpModelSpec) Executor ¶
func (b *BaseSubResourceExpModelSpec) Executor() spec.Executor
func (*BaseSubResourceExpModelSpec) ExpModels ¶
func (b *BaseSubResourceExpModelSpec) ExpModels() []spec.ExpModelCommandSpec
type CommonExecutor ¶ added in v1.6.0
func (*CommonExecutor) Name ¶ added in v1.6.0
func (e *CommonExecutor) Name() string
func (*CommonExecutor) SetChannel ¶ added in v1.6.0
func (e *CommonExecutor) SetChannel(channel spec.Channel)
type ContainerMatchedList ¶ added in v0.7.0
type ContainerMatchedList []ContainerObjectMeta
func GetContainerObjectMetaListFromContext ¶ added in v0.7.0
func GetContainerObjectMetaListFromContext(ctx context.Context) (ContainerMatchedList, error)
GetContainerObjectMetaListFromContext returns the matched container list
type ContainerObjectMeta ¶
type ContainerObjectMeta struct { // experiment id Id string ContainerRuntime string ContainerId string ContainerName string PodName string NodeName string Namespace string }
func ParseIdentifier ¶ added in v0.7.0
func ParseIdentifier(identifier string) ContainerObjectMeta
Namespace/Node/Pod/ContainerName/ContainerId/containerRuntime
func (*ContainerObjectMeta) GetIdentifier ¶ added in v0.7.0
func (c *ContainerObjectMeta) GetIdentifier() string
type CopyOptions ¶ added in v0.7.0
type CopyOptions struct {
DeployOptions
}
func (*CopyOptions) DeployToPod ¶ added in v1.3.0
func (o *CopyOptions) DeployToPod(experimentId, src, dest string) error
DeployToPod copies src file or directory to specify container
type DeployMode ¶ added in v1.3.0
type DeployOptions ¶ added in v1.3.0
type DeployOptions struct { Container string Namespace string PodName string // contains filtered or unexported fields }
func (*DeployOptions) CheckFileExists ¶ added in v1.3.0
func (o *DeployOptions) CheckFileExists(dest string) error
CheckFileExists return nil if dest file exists
func (*DeployOptions) CreateDir ¶ added in v1.3.0
func (o *DeployOptions) CreateDir(dir string) error
type DoWorkFunc ¶ added in v1.2.0
type DoWorkFunc func(workID int)
type DownloadOptions ¶ added in v1.3.0
type DownloadOptions struct { DeployOptions // contains filtered or unexported fields }
func (*DownloadOptions) DeployToPod ¶ added in v1.3.0
func (d *DownloadOptions) DeployToPod(experimentId, src, dest string) error
type ExecCommandInPodExecutor ¶
func (*ExecCommandInPodExecutor) Exec ¶
func (e *ExecCommandInPodExecutor) Exec(uid string, ctx context.Context, expModel *spec.ExpModel) *spec.Response
execInMatchedPod will execute the experiment in the target pod
func (*ExecCommandInPodExecutor) Name ¶
func (e *ExecCommandInPodExecutor) Name() string
func (*ExecCommandInPodExecutor) SetChannel ¶
func (e *ExecCommandInPodExecutor) SetChannel(channel spec.Channel)
type ExpController ¶
type ExpController interface { // controller Name Name() string // Create Create(bladeName string, expSpec v1alpha1.ExperimentSpec) v1alpha1.ExperimentStatus // Destroy Destroy(bladeName string, expSpec v1alpha1.ExperimentSpec, oldExpStatus v1alpha1.ExperimentStatus) v1alpha1.ExperimentStatus }
type ExperimentController ¶
type ExperimentController interface { // controller Name Name() string // Create experiment Create(ctx context.Context, expSpec v1alpha1.ExperimentSpec) *spec.Response // Destroy Destroy(ctx context.Context, expSpec v1alpha1.ExperimentSpec, oldExpStatus v1alpha1.ExperimentStatus) *spec.Response }
type ExperimentIdentifierInPod ¶ added in v0.7.0
type OSSubResourceModelSpec ¶ added in v0.7.0
type OSSubResourceModelSpec struct {
BaseSubResourceExpModelSpec
}
type ResourceExpModelSpec ¶
type ResourceExpModelSpec interface { Scope() string ExpModels() map[string]spec.ExpModelCommandSpec GetExpActionModelSpec(target, action string) spec.ExpActionCommandSpec }
ResourceExpModelSpec contains node, pod, container
type SubResourceExpModelSpec ¶
type SubResourceExpModelSpec interface { ExpModels() []spec.ExpModelCommandSpec Executor() spec.Executor }
SubResourceExpModelSpec contains os exps in node, network exp in pod and os exps in container
func NewOSSubResourceModelSpec ¶ added in v0.7.0
func NewOSSubResourceModelSpec() SubResourceExpModelSpec