Documentation
¶
Index ¶
- Variables
- func CleanupAll()
- func DiscoverComposeServices(cwd string) ([]string, string, error)
- func EvaluateSteadyState(probes []config.SteadyStateProbe) error
- func GenerateDefaultChaosConfig(services []string, outPath string) error
- func GenerateTopologyTree(dir string) (*pterm.TreeNode, error)
- type ActionHandler
- type ChaosEngine
- type ComposeFile
- type ComposeService
- type ContainerInfo
- type DeployConfig
- type DockerClient
- func (d *DockerClient) Close()
- func (d *DockerClient) ExecCommand(name string, cmd []string) (int, error)
- func (d *DockerClient) GetContainerPID(name string) (int, error)
- func (d *DockerClient) ListContainers(all bool) ([]ContainerInfo, error)
- func (d *DockerClient) PauseContainer(name string) (*ContainerInfo, error)
- func (d *DockerClient) RestartContainer(name string, timeout int) (*ContainerInfo, error)
- func (d *DockerClient) StopContainer(name string, timeout int) (*ContainerInfo, error)
- func (d *DockerClient) UnpauseContainer(name string) (*ContainerInfo, error)
- func (d *DockerClient) UpdateContainerResources(name string, cpuQuota int64, cpuPeriod int64, memLimit int64) (*ContainerInfo, error)
- type DoctorIssue
- type DoctorResult
- type EngineStatus
- type HealthCheckConfig
- type NetworkChaosManager
- func (m *NetworkChaosManager) Clear(name string, pid *int)
- func (m *NetworkChaosManager) ClearAll()
- func (m *NetworkChaosManager) InjectDelay(name string, pid int, latencyMs int, jitterMs int, duration *int) error
- func (m *NetworkChaosManager) InjectLoss(name string, pid int, percent int, duration *int) error
- type ProbeResult
- type PrometheusResponse
- type ResourceChaosManager
- type ResourceConfig
- type ResourceLimits
- type ScenarioResult
- type ScenarioRunner
- type TopologyNode
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NetworkManager = NewNetworkChaosManager() ResourceManager = NewResourceChaosManager() )
View Source
var ActionHandlers = map[string]ActionHandler{
"stop": actionStop,
"restart": actionRestart,
"pause": actionPause,
"delay": actionDelay,
"loss": actionLoss,
"limit_cpu": actionLimitCPU,
"limit_memory": actionLimitMemory,
}
Functions ¶
func CleanupAll ¶
func CleanupAll()
func EvaluateSteadyState ¶
func EvaluateSteadyState(probes []config.SteadyStateProbe) error
EvaluateSteadyState checks the steady state probes against their sources.
Types ¶
type ActionHandler ¶
type ActionHandler func(client *DockerClient, target string, spec config.ActionSpec) (*ContainerInfo, error)
type ChaosEngine ¶
type ChaosEngine struct {
// contains filtered or unexported fields
}
func NewChaosEngine ¶
func NewChaosEngine(cfg *config.ChaosConfig, onEvent func(utils.EventRecord), logger *utils.ChaosLogger) *ChaosEngine
func (*ChaosEngine) Start ¶
func (e *ChaosEngine) Start() error
func (*ChaosEngine) Status ¶
func (e *ChaosEngine) Status() EngineStatus
func (*ChaosEngine) Stop ¶
func (e *ChaosEngine) Stop()
type ComposeFile ¶
type ComposeFile struct {
Services map[string]ComposeService `yaml:"services"`
}
type ComposeService ¶
type ComposeService struct {
Image string `yaml:"image"`
Deploy *DeployConfig `yaml:"deploy"`
Restart string `yaml:"restart"`
HealthCheck *HealthCheckConfig `yaml:"healthcheck"`
Privileged bool `yaml:"privileged"`
Networks interface{} `yaml:"networks"` // Can be list or map
}
ComposeService represents a subset of docker-compose service configuration used by the doctor for analyzing resilience.
type ContainerInfo ¶
type ContainerInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Image string `json:"image"`
Status string `json:"status"`
Ports map[string]string `json:"ports"`
}
func Dispatch ¶
func Dispatch(action config.ActionSpec, client *DockerClient, target string) (*ContainerInfo, error)
type DeployConfig ¶
type DeployConfig struct {
Replicas int `yaml:"replicas"`
Resources *ResourceConfig `yaml:"resources"`
}
type DockerClient ¶
type DockerClient struct {
// contains filtered or unexported fields
}
func NewDockerClient ¶
func NewDockerClient(allowedTargets []string) (*DockerClient, error)
func (*DockerClient) Close ¶
func (d *DockerClient) Close()
func (*DockerClient) ExecCommand ¶
func (d *DockerClient) ExecCommand(name string, cmd []string) (int, error)
func (*DockerClient) GetContainerPID ¶
func (d *DockerClient) GetContainerPID(name string) (int, error)
func (*DockerClient) ListContainers ¶
func (d *DockerClient) ListContainers(all bool) ([]ContainerInfo, error)
func (*DockerClient) PauseContainer ¶
func (d *DockerClient) PauseContainer(name string) (*ContainerInfo, error)
func (*DockerClient) RestartContainer ¶
func (d *DockerClient) RestartContainer(name string, timeout int) (*ContainerInfo, error)
func (*DockerClient) StopContainer ¶
func (d *DockerClient) StopContainer(name string, timeout int) (*ContainerInfo, error)
func (*DockerClient) UnpauseContainer ¶
func (d *DockerClient) UnpauseContainer(name string) (*ContainerInfo, error)
func (*DockerClient) UpdateContainerResources ¶
func (d *DockerClient) UpdateContainerResources(name string, cpuQuota int64, cpuPeriod int64, memLimit int64) (*ContainerInfo, error)
type DoctorIssue ¶
type DoctorIssue struct {
Severity string // "CRITICAL", "WARNING"
Category string // "SPOF", "RESOURCES", "RECOVERY", "OBSERVABILITY", "SECURITY"
Message string
}
DoctorIssue represents a single resilience issue found in a service
type DoctorResult ¶
type DoctorResult struct {
ServiceName string
Issues []DoctorIssue
}
DoctorResult represents the analysis result for a specific service
func AnalyzeTopology ¶
func AnalyzeTopology(dir string) ([]DoctorResult, error)
AnalyzeTopology reads docker-compose.yml from the given directory and analyzes it for resilience anti-patterns.
type EngineStatus ¶
type EngineStatus struct {
Running bool
Config *config.ChaosConfig
CycleCount int
DownContainers []string
LastEvent *utils.EventRecord
History []utils.EventRecord
LastInjectionTime time.Time
CooldownRemaining float64
}
type HealthCheckConfig ¶
type HealthCheckConfig struct {
Test interface{} `yaml:"test"` // can be string or list
Disable bool `yaml:"disable"`
}
type NetworkChaosManager ¶
type NetworkChaosManager struct {
// contains filtered or unexported fields
}
func NewNetworkChaosManager ¶
func NewNetworkChaosManager() *NetworkChaosManager
func (*NetworkChaosManager) Clear ¶
func (m *NetworkChaosManager) Clear(name string, pid *int)
func (*NetworkChaosManager) ClearAll ¶
func (m *NetworkChaosManager) ClearAll()
func (*NetworkChaosManager) InjectDelay ¶
func (*NetworkChaosManager) InjectLoss ¶
type ProbeResult ¶
func RunProbe ¶
func RunProbe(spec *config.ProbeSpec, dc *DockerClient) ProbeResult
type PrometheusResponse ¶
type ResourceChaosManager ¶
type ResourceChaosManager struct {
// contains filtered or unexported fields
}
func NewResourceChaosManager ¶
func NewResourceChaosManager() *ResourceChaosManager
func (*ResourceChaosManager) ClearAll ¶
func (m *ResourceChaosManager) ClearAll()
func (*ResourceChaosManager) ScheduleRestore ¶
func (m *ResourceChaosManager) ScheduleRestore(client *DockerClient, target string, duration int)
type ResourceConfig ¶
type ResourceConfig struct {
Limits *ResourceLimits `yaml:"limits"`
}
type ResourceLimits ¶
type ScenarioResult ¶
type ScenarioRunner ¶
type ScenarioRunner struct {
// contains filtered or unexported fields
}
func NewScenarioRunner ¶
func NewScenarioRunner(cfg *config.ScenarioConfig, logCb func(string)) *ScenarioRunner
func (*ScenarioRunner) RevertAll ¶
func (r *ScenarioRunner) RevertAll()
func (*ScenarioRunner) Run ¶
func (r *ScenarioRunner) Run() ScenarioResult
type TopologyNode ¶
Click to show internal directories.
Click to hide internal directories.