config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ValidActions    = []string{"stop", "restart", "pause", "delay", "loss", "limit_cpu", "limit_memory"}
	NetworkActions  = []string{"delay", "loss"}
	ResourceActions = []string{"limit_cpu", "limit_memory"}
)

Functions

This section is empty.

Types

type ActionSpec

type ActionSpec struct {
	Name        string  `yaml:"name"`
	LatencyMs   int     `yaml:"latency_ms,omitempty"`
	JitterMs    int     `yaml:"jitter_ms,omitempty"`
	LossPercent int     `yaml:"loss_percent,omitempty"`
	CPUs        float64 `yaml:"cpus,omitempty"`
	MemoryMB    int     `yaml:"memory_mb,omitempty"`
	Duration    *int    `yaml:"duration,omitempty"`
}

func (*ActionSpec) IsNetwork

func (a *ActionSpec) IsNetwork() bool

func (*ActionSpec) IsResource

func (a *ActionSpec) IsResource() bool

func (*ActionSpec) UnmarshalYAML

func (a *ActionSpec) UnmarshalYAML(value *yaml.Node) error

type ChaosConfig

type ChaosConfig struct {
	Interval int          `yaml:"interval"`
	Targets  []string     `yaml:"targets"`
	Actions  []ActionSpec `yaml:"actions"`
	Safety   SafetyConfig `yaml:"safety"`
}

func LoadConfig

func LoadConfig(path string) (*ChaosConfig, error)

func (*ChaosConfig) Validate

func (c *ChaosConfig) Validate() error

type ProbeSpec

type ProbeSpec struct {
	Type            string `yaml:"type"`
	URL             string `yaml:"url,omitempty"`               // For HTTP
	ExpectStatus    *int   `yaml:"expect_status,omitempty"`     // For HTTP
	ExpectNotStatus *int   `yaml:"expect_not_status,omitempty"` // For HTTP
	Timeout         int    `yaml:"timeout,omitempty"`           // Global
	HostPort        string `yaml:"host_port,omitempty"`         // For TCP
	Target          string `yaml:"target,omitempty"`            // For Exec
	Command         string `yaml:"command,omitempty"`           // For Exec
}

type SafetyConfig

type SafetyConfig struct {
	MaxDown  int  `yaml:"max_down"`
	Cooldown int  `yaml:"cooldown"`
	DryRun   bool `yaml:"dry_run"`
}

type ScenarioConfig

type ScenarioConfig struct {
	Name        string             `yaml:"name"`
	Description string             `yaml:"description"`
	Hypothesis  string             `yaml:"hypothesis"`
	SteadyState []SteadyStateProbe `yaml:"steady_state,omitempty"`
	Steps       []ScenarioStep     `yaml:"steps"`
}

func LoadScenario

func LoadScenario(path string) (*ScenarioConfig, error)

type ScenarioStep

type ScenarioStep struct {
	Type      string      `yaml:"-"`
	DurationS int         `yaml:"-"`
	Action    *ActionSpec `yaml:"-"`
	Target    string      `yaml:"-"`
	Probe     *ProbeSpec  `yaml:"-"`
}

func (*ScenarioStep) UnmarshalYAML

func (s *ScenarioStep) UnmarshalYAML(value *yaml.Node) error

type SteadyStateProbe

type SteadyStateProbe struct {
	Metric    string `yaml:"metric"`
	Source    string `yaml:"source"` // e.g., "prometheus"
	Query     string `yaml:"query"`
	Threshold string `yaml:"threshold"` // e.g., "< 250"
}

Jump to

Keyboard shortcuts

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