Documentation ¶
Index ¶
- Constants
- Variables
- func ExecCmd(command string) (string, error)
- func InitDefaultLogging()
- func MarshalTemplate(jobSpec interface{}, name, templateString string) (string, error)
- func RunCLI(args []string) error
- func SetGlobalLogger(l zerolog.Logger)
- type ActionablePodInfo
- type BlockchainNodeConfig
- type BlockchainRewindHead
- type BlockchainRewindHeadExperiment
- type CRD
- type ChaosSpecs
- type CommonExperimentMeta
- type Config
- type Controller
- func (m *Controller) AnnotateExperiment(a *ExperimentAction) error
- func (m *Controller) ApplyAndAnnotate(exp *NamedExperiment) error
- func (m *Controller) ApplyCustomKindChaosFile(exp *NamedExperiment, chaosType string, wait bool) error
- func (m *Controller) ApplyExperiment(exp *NamedExperiment, wait bool) error
- func (m *Controller) GenerateSpecs(ns string) error
- func (m *Controller) GetPodsInfo(namespace string) (*PodsListResponse, error)
- func (m *Controller) ParseOpenAPISpecs() ([]*OAPISpecData, error)
- func (m *Controller) ReadExperimentsFromDir(expTypes []string, dir string) ([]*NamedExperiment, error)
- func (m *Controller) Run() error
- func (m *Controller) Stop() []error
- func (m *Controller) Wait() []error
- type CurrentBlockResponse
- type EventJSONItemResponse
- type EventsJSONResponse
- type ExperimentAction
- type ExperimentAnnotationBody
- type ExternalTargets
- type Failure
- type Grafana
- type GroupInfo
- type HTTPExperiment
- type Havoc
- type Latency
- type ManifestPart
- type Metadata
- type Monkey
- type NamedExperiment
- type NetworkChaosExperiment
- type NetworkChaosExternalPartitionExperiment
- type NetworkChaosGroupPartitionExperiment
- type NetworkPartition
- type OAPISpecData
- type OpenAPI
- type OpenApiSpecInfo
- type PodFailureExperiment
- type PodResponse
- type PodStressCPUExperiment
- type PodStressMemoryExperiment
- type PodsListResponse
- type SpecToPort
- type StressCPU
- type StressMemory
Constants ¶
View Source
const ( DefaultCMDTimeout = "3m" ErrNoSelection = "no selection, exiting" ErrInvalidNamespace = "first argument must be a valid k8s namespace" ErrAutocompleteError = "autocomplete file walk errored" )
View Source
const ( ErrReadSethConfig = "failed to read TOML config for havoc" ErrUnmarshalSethConfig = "failed to unmarshal TOML config for havoc" ErrFailureGroupIsNil = "failure group must be specified in config" ErrLatencyGroupIsNil = "latency group must be specified in config" ErrStressCPUGroupIsNil = "stress cpu group must be specified in config" ErrStressMemoryGroupIsNil = "stress memory group must be specified in config" ErrFormat = "format error" )
View Source
const ( DefaultExperimentsDir = "havoc-experiments" DefaultPodFailureDuration = "1m" DefaultNetworkLatencyDuration = "1m" DefaultNetworkPartitionDuration = "1m" DefaultHTTPDuration = "1m" DefaultNetworkPartitionLabel = "havoc-network-group" DefaultComponentGroupLabelKey = "havoc-component-group" DefaultStressMemoryDuration = "1m" DefaultStressMemoryWorkers = 1 DefaultStressMemoryAmount = "512MB" DefaultStressCPUDuration = "1m" DefaultStressCPUWorkers = 1 DefaultStressCPULoad = 100 DefaultNetworkLatency = "300ms" DefaultMonkeyDuration = "24h" DefaultMonkeyMode = "seq" DefaultMonkeyCooldown = "30s" )
View Source
const ( ErrParsingTemplate = "failed to parse Go text template" ErrExperimentTimeout = "waiting for experiment to finish timed out" ErrExperimentApply = "error applying experiment manifest" ErrInvalidCustomKind = "invalid custom Kind of experiment" )
View Source
const ( ChaosTypeBlockchainSetHead = "blockchain_rewind_head" ChaosTypeFailure = "failure" ChaosTypeGroupFailure = "group-failure" ChaosTypeLatency = "latency" ChaosTypeGroupLatency = "group-latency" ChaosTypeStressMemory = "memory" ChaosTypeStressGroupMemory = "group-memory" ChaosTypeStressCPU = "cpu" ChaosTypeStressGroupCPU = "group-cpu" ChaosTypePartitionExternal = "external" ChaosTypePartitionGroup = "group-partition" ChaosTypeHTTP = "http" )
View Source
const ( MonkeyModeSeq = "seq" MonkeyModeRandom = "rand" ErrInvalidMode = "monkey mode is invalid, should be either \"seq\" or \"rand\"" )
View Source
const ( ErrNoNamespace = "no namespace found" ErrEmptyNamespace = "no pods found inside namespace, namespace is empty or check your filter" )
View Source
const (
DebugContainerImage = "curlimages/curl:latest"
)
View Source
const (
ErrParsingOpenAPISpec = "failed to parse OpenAPISpec"
)
View Source
const (
NoGroupKey = "no-group"
)
Variables ¶
View Source
var ( DefaultGroupPercentage = []string{"10", "20", "30"} DefaultGroupFixed = []string{"1", "2", "3"} DefaultNetworkPartitionGroupPercentage = []string{"100"} )
View Source
var (
DefaultIgnoreGroupLabels = []string{
"mainnet",
"release",
"intents.otterize.com",
"pod-template-hash",
"rollouts-pod-template-hash",
"chain.link/app",
"chain.link/cost-center",
"chain.link/env",
"chain.link/project",
"chain.link/team",
"app.kubernetes.io/part-of",
"app.kubernetes.io/managed-by",
"app.chain.link/product",
"app.kubernetes.io/version",
"app.chain.link/blockchain",
"app.kubernetes.io/instance",
"app.kubernetes.io/name",
}
)
View Source
var (
ExperimentTypesToCRDNames = map[string]string{
"PodChaos": "podchaos.chaos-mesh.org",
"StressChaos": "stresschaos.chaos-mesh.org",
"NetworkChaos": "networkchaos.chaos-mesh.org",
"HTTPChaos": "httpchaos.chaos-mesh.org",
}
)
View Source
var L zerolog.Logger
View Source
var (
OpenAPIPathParam = regexp.MustCompile(`({.*})`)
)
View Source
var ( RecommendedExperimentTypes = []string{ ChaosTypeFailure, ChaosTypeLatency, ChaosTypeGroupFailure, ChaosTypeGroupLatency, ChaosTypeStressMemory, ChaosTypeStressGroupMemory, ChaosTypeStressCPU, ChaosTypeStressGroupCPU, ChaosTypePartitionGroup, ChaosTypeHTTP, } )
Functions ¶
func InitDefaultLogging ¶
func InitDefaultLogging()
func MarshalTemplate ¶
MarshalTemplate Helper to marshal templates
func SetGlobalLogger ¶
Types ¶
type ActionablePodInfo ¶
ActionablePodInfo info about pod and labels for which we can generate a chaos experiment
type BlockchainNodeConfig ¶ added in v0.2.5
type BlockchainRewindHead ¶ added in v0.1.3
type BlockchainRewindHead struct { Duration string `toml:"duration"` NodesConfig []*BlockchainNodeConfig `toml:"nodes"` }
type BlockchainRewindHeadExperiment ¶ added in v0.1.3
type BlockchainRewindHeadExperiment struct { ExperimentName string `yaml:"experimentName"` Metadata *Metadata `yaml:"metadata"` Namespace string `yaml:"namespace"` PodName string `yaml:"podName"` ExecutorPodPrefix string `yaml:"executorPodPrefix"` ExecutorContainerName string `yaml:"executorContainerName"` NodeInternalHTTPURL string `yaml:"nodeInternalHTTPURL"` Blocks int64 `yaml:"blocks"` }
func (BlockchainRewindHeadExperiment) String ¶ added in v0.1.3
func (m BlockchainRewindHeadExperiment) String() (string, error)
type ChaosSpecs ¶
func (*ChaosSpecs) Dump ¶
func (m *ChaosSpecs) Dump(dir string) error
type CommonExperimentMeta ¶
type Config ¶
type Config struct {
Havoc *Havoc `toml:"havoc"`
}
func DefaultConfig ¶
func DefaultConfig() *Config
func ReadConfig ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(cfg *Config) (*Controller, error)
func (*Controller) AnnotateExperiment ¶
func (m *Controller) AnnotateExperiment(a *ExperimentAction) error
AnnotateExperiment sends annotation marker to Grafana dashboard
func (*Controller) ApplyAndAnnotate ¶
func (m *Controller) ApplyAndAnnotate(exp *NamedExperiment) error
func (*Controller) ApplyCustomKindChaosFile ¶ added in v0.1.3
func (m *Controller) ApplyCustomKindChaosFile(exp *NamedExperiment, chaosType string, wait bool) error
func (*Controller) ApplyExperiment ¶ added in v0.1.4
func (m *Controller) ApplyExperiment(exp *NamedExperiment, wait bool) error
func (*Controller) GenerateSpecs ¶
func (m *Controller) GenerateSpecs(ns string) error
GenerateSpecs generates specs from namespace, should be used programmatically in tests
func (*Controller) GetPodsInfo ¶
func (m *Controller) GetPodsInfo(namespace string) (*PodsListResponse, error)
GetPodsInfo gets info about all the pods in the namespace
func (*Controller) ParseOpenAPISpecs ¶ added in v0.2.1
func (m *Controller) ParseOpenAPISpecs() ([]*OAPISpecData, error)
ParseOpenAPISpecs parses OpenAPI spec methods
func (*Controller) ReadExperimentsFromDir ¶
func (m *Controller) ReadExperimentsFromDir(expTypes []string, dir string) ([]*NamedExperiment, error)
func (*Controller) Run ¶
func (m *Controller) Run() error
func (*Controller) Stop ¶
func (m *Controller) Stop() []error
func (*Controller) Wait ¶
func (m *Controller) Wait() []error
type CurrentBlockResponse ¶ added in v0.1.3
type CurrentBlockResponse struct {
Result string `json:"result"`
}
type EventJSONItemResponse ¶
type EventJSONItemResponse struct { APIVersion string `json:"apiVersion"` Count int `json:"count"` EventTime any `json:"eventTime"` FirstTimestamp time.Time `json:"firstTimestamp"` InvolvedObject struct { APIVersion string `json:"apiVersion"` Kind string `json:"kind"` Name string `json:"name"` Namespace string `json:"namespace"` ResourceVersion string `json:"resourceVersion"` UID string `json:"uid"` } `json:"involvedObject"` Kind string `json:"kind"` LastTimestamp time.Time `json:"lastTimestamp"` Message string `json:"message"` Metadata struct { Annotations struct { ChaosMeshOrgType string `json:"chaos-mesh.org/type"` } `json:"annotations"` CreationTimestamp time.Time `json:"creationTimestamp"` Name string `json:"name"` Namespace string `json:"namespace"` ResourceVersion string `json:"resourceVersion"` UID string `json:"uid"` } `json:"metadata"` Reason string `json:"reason"` ReportingComponent string `json:"reportingComponent"` ReportingInstance string `json:"reportingInstance"` Source struct { Component string `json:"component"` } `json:"source"` Type string `json:"type"` }
type EventsJSONResponse ¶
type EventsJSONResponse struct { APIVersion string `json:"apiVersion"` Items []*EventJSONItemResponse `json:"items"` Kind string `json:"kind"` Metadata struct { ResourceVersion string `json:"resourceVersion"` } `json:"metadata"` }
type ExperimentAction ¶
type ExternalTargets ¶
type HTTPExperiment ¶ added in v0.2.1
type HTTPExperiment struct { ExperimentName string Metadata *Metadata Namespace string Mode string ModeValue string Selector string PodName string Port int64 Target string Path string Method string Abort bool Duration string }
func (HTTPExperiment) String ¶ added in v0.2.1
func (m HTTPExperiment) String() (string, error)
type Havoc ¶
type Havoc struct { Dir string `toml:"dir"` ExperimentTypes []string `toml:"experiment_types"` NamespaceLabelFilter string `toml:"namespace_label_filter"` ComponentLabelKey string `toml:"component_label_key"` IgnoredPods []string `toml:"ignore_pods"` IgnoreGroupLabels []string `toml:"ignore_group_labels"` Failure *Failure `toml:"failure"` Latency *Latency `toml:"latency"` NetworkPartition *NetworkPartition `toml:"network_partition"` StressMemory *StressMemory `toml:"stress_memory"` StressCPU *StressCPU `toml:"stress_cpu"` ExternalTargets *ExternalTargets `toml:"external_targets"` BlockchainRewindHead *BlockchainRewindHead `toml:"blockchain_rewind_head"` OpenAPI *OpenAPI `toml:"openapi"` Monkey *Monkey `toml:"monkey"` Grafana *Grafana `toml:"grafana"` }
type ManifestPart ¶
type NamedExperiment ¶
func NewNamedExperiment ¶ added in v0.1.4
func NewNamedExperiment(expPath string) (*NamedExperiment, error)
type NetworkChaosExperiment ¶
type NetworkChaosExperiment struct { ExperimentName string Mode string ModeValue string Namespace string Duration string Latency string PodName string Selector string }
func (NetworkChaosExperiment) String ¶
func (m NetworkChaosExperiment) String() (string, error)
type NetworkChaosExternalPartitionExperiment ¶
type NetworkChaosExternalPartitionExperiment struct { ExperimentName string Namespace string Duration string PodName string ExternalURL string }
func (NetworkChaosExternalPartitionExperiment) String ¶
func (m NetworkChaosExternalPartitionExperiment) String() (string, error)
type NetworkChaosGroupPartitionExperiment ¶
type NetworkChaosGroupPartitionExperiment struct { ExperimentName string ModeTo string ModeToValue string ModeFrom string ModeFromValue string Direction string Namespace string Duration string SelectorFrom string SelectorTo string }
func (NetworkChaosGroupPartitionExperiment) String ¶
func (m NetworkChaosGroupPartitionExperiment) String() (string, error)
type NetworkPartition ¶
type OAPISpecData ¶ added in v0.2.1
type OpenAPI ¶ added in v0.2.1
type OpenAPI struct { Mapping map[string]*OpenApiSpecInfo `toml:"mapping"` Duration string `toml:"duration"` GroupPercentage []string `toml:"group_percentage"` GroupFixed []string `toml:"group_fixed"` }
type OpenApiSpecInfo ¶ added in v0.2.1
type OpenApiSpecInfo struct {
SpecToPortMappings []*SpecToPort `toml:"spec_to_port"`
}
type PodFailureExperiment ¶
type PodFailureExperiment struct { ExperimentName string Mode string ModeValue string Namespace string Duration string PodName string Selector string }
func (PodFailureExperiment) String ¶
func (m PodFailureExperiment) String() (string, error)
type PodResponse ¶
type PodResponse struct { Metadata struct { Name string `json:"name"` Labels map[string]string `json:"labels"` } `json:"metadata"` }
PodResponse pod info response from kubectl in JSON
type PodStressCPUExperiment ¶
type PodStressCPUExperiment struct { ExperimentName string Mode string ModeValue string Namespace string Workers int Load int Duration string PodName string Selector string }
func (PodStressCPUExperiment) String ¶
func (m PodStressCPUExperiment) String() (string, error)
type PodStressMemoryExperiment ¶
type PodStressMemoryExperiment struct { ExperimentName string Mode string ModeValue string Namespace string Workers int Memory string Duration string PodName string Selector string }
func (PodStressMemoryExperiment) String ¶
func (m PodStressMemoryExperiment) String() (string, error)
type PodsListResponse ¶
type PodsListResponse struct {
Items []*PodResponse `json:"items"`
}
PodsListResponse pod list response from kubectl in JSON
type SpecToPort ¶ added in v0.2.1
Source Files ¶
Click to show internal directories.
Click to hide internal directories.