chaos

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// APIBasePath in form of /apis/<spec.group>/<spec.versions.name>, see Chaosmesh CRD 2.0.0
	APIBasePath = "/apis/chaos-mesh.org/v1alpha1"
	// TemplatesPath path to the chaos templates
	TemplatesPath = "chaos/templates"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CRDPayload

type CRDPayload struct {
	Name     string
	Resource string
	Data     []byte
}

CRDPayload Custom Resource Definition call payload

type Config

type Config struct {
	Client        *kubernetes.Clientset
	NamespaceName string
}

Config Chaosmesh controller config

type Controller

type Controller struct {
	Client   *kubernetes.Clientset
	Requests map[string]*rest.Request
	Cfg      *Config
}

Controller is controller that manages Chaosmesh CRD instances to run experiments

func NewController

func NewController(cfg *Config) (*Controller, error)

NewController creates controller to run and stop chaos experiments

func (*Controller) Run

func (c *Controller) Run(exp Experimentable) (string, error)

Run runs experiment and saves it's ID

func (*Controller) RunTemplate

func (c *Controller) RunTemplate(tmplPath string) (*ExperimentInfo, error)

RunTemplate applies chaos from yaml template to a particular environment

func (*Controller) Stop

func (c *Controller) Stop(name string) error

Stop removes experiment's entity

func (*Controller) StopAll

func (c *Controller) StopAll() error

StopAll removes all experiments entities

func (*Controller) StopAllStandalone

func (c *Controller) StopAllStandalone(expInfos map[string]*ExperimentInfo) error

StopAllStandalone stops all chaos experiments for a presets env

func (*Controller) StopStandalone

func (c *Controller) StopStandalone(expInfo *ExperimentInfo) error

StopStandalone removes experiment's entity for a presets env

type ExperimentInfo

type ExperimentInfo struct {
	Name     string `json:"name,omitempty" mapstructure:"name"`
	Resource string `json:"resource,omitempty" mapstructure:"resource"`
}

ExperimentInfo persistent experiment info

type Experimentable

type Experimentable interface {
	SetBase(base experiments.Base)
	Filename() string
	Resource() string
}

Experimentable interface for chaos experiments

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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