Documentation ¶
Overview ¶
Package disruptors implements an API for disrupting targets
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentController ¶
type AgentController interface { // InjectDisruptorAgent injects the Disruptor agent in the target pods InjectDisruptorAgent() error // ExecCommand executes a command in the targets of the AgentController and reports any error ExecCommand(cmd []string) error // Targets returns the list of targets for the controller Targets() ([]string, error) // Visit allows executing a different command on each target returned by a visiting function Visit(func(target string) []string) error }
AgentController defines the interface for controlling agents in a set of targets
func NewAgentController ¶ added in v0.2.0
func NewAgentController( ctx context.Context, k8s kubernetes.Kubernetes, namespace string, targets []string, timeout time.Duration, ) AgentController
NewAgentController creates a new controller for a list of target pods
type GrpcDisruptionOptions ¶ added in v0.2.0
type GrpcDisruptionOptions struct { // Port used by the agent for listening ProxyPort uint `js:"proxyPort"` // Network interface the agent will be listening traffic from Iface string }
GrpcDisruptionOptions defines options for the injection of grpc faults in a target pod
type GrpcFault ¶ added in v0.2.0
type GrpcFault struct { // port the disruptions will be applied to Port uint // Average delay introduced to requests AverageDelay uint `js:"averageDelay"` // Variation in the delay (with respect of the average delay) DelayVariation uint `js:"delayVariation"` // Fraction (in the range 0.0 to 1.0) of requests that will return an error ErrorRate float32 `js:"errorRate"` // Status code to be returned by requests selected to return an error StatusCode int32 `js:"statusCode"` // Status message to be returned in requests selected to return an error StatusMessage string `js:"statusMessage"` // List of grpc services to be excluded from disruptions Exclude string `js:"exclude"` }
GrpcFault specifies a fault to be injected in grpc requests
type HTTPDisruptionOptions ¶
type HTTPDisruptionOptions struct { // Port used by the agent for listening ProxyPort uint `js:"proxyPort"` // Network interface the agent will be listening traffic from Iface string }
HTTPDisruptionOptions defines options for the injection of HTTP faults in a target pod
type HTTPFault ¶
type HTTPFault struct { // port the disruptions will be applied to Port uint // Average delay introduced to requests AverageDelay uint `js:"averageDelay"` // Variation in the delay (with respect of the average delay) DelayVariation uint `js:"delayVariation"` // Fraction (in the range 0.0 to 1.0) of requests that will return an error ErrorRate float32 `js:"errorRate"` // Error code to be returned by requests selected in the error rate ErrorCode uint `js:"errorCode"` // Body to be returned when an error is injected ErrorBody string `js:"errorBody"` // Comma-separated list of url paths to be excluded from disruptions Exclude string }
HTTPFault specifies a fault to be injected in http requests
type PodAttributes ¶
PodAttributes defines the attributes a Pod must match for being selected/excluded
type PodDisruptor ¶
type PodDisruptor interface { // Targets returns the list of targets for the disruptor Targets() ([]string, error) // InjectHTTPFault injects faults in the HTTP requests sent to the disruptor's targets // for the specified duration (in seconds) InjectHTTPFaults(fault HTTPFault, duration uint, options HTTPDisruptionOptions) error // InjectGrpcFault injects faults in the grpc requests sent to the disruptor's targets // for the specified duration (in seconds) InjectGrpcFaults(fault GrpcFault, duration uint, options GrpcDisruptionOptions) error }
PodDisruptor defines the types of faults that can be injected in a Pod
func NewPodDisruptor ¶
func NewPodDisruptor( ctx context.Context, k8s kubernetes.Kubernetes, selector PodSelector, options PodDisruptorOptions, ) (PodDisruptor, error)
NewPodDisruptor creates a new instance of a PodDisruptor that acts on the pods that match the given PodSelector
type PodDisruptorOptions ¶
type PodDisruptorOptions struct { // timeout when waiting agent to be injected in seconds (default 30s). A zero value forces default. // A Negative value forces no waiting. InjectTimeout int `js:"injectTimeout"` }
PodDisruptorOptions defines options that controls the PodDisruptor's behavior
type PodSelector ¶
type PodSelector struct { Namespace string // Select Pods that match these PodAttributes Select PodAttributes // Select Pods that match these PodAttributes Exclude PodAttributes }
PodSelector defines the criteria for selecting a pod for disruption
func (*PodSelector) GetTargets ¶
func (s *PodSelector) GetTargets(ctx context.Context, k8s kubernetes.Kubernetes) ([]string, error)
GetTargets retrieves the names of the targets of the disruptor
type PortMapper ¶ added in v0.2.1
type PortMapper struct {
// contains filtered or unexported fields
}
PortMapper maps ports of a service to a list of pod, port pairs
func NewPortMapper ¶ added in v0.2.1
func NewPortMapper( ctx context.Context, service *corev1.Service, endpoints *corev1.Endpoints, ) PortMapper
NewPortMapper creates a new port mapper for a service
type ServiceDisruptor ¶
type ServiceDisruptor interface { PodDisruptor }
ServiceDisruptor defines operations for injecting faults in services
func NewServiceDisruptor ¶
func NewServiceDisruptor( ctx context.Context, k8s kubernetes.Kubernetes, name string, namespace string, options ServiceDisruptorOptions, ) (ServiceDisruptor, error)
NewServiceDisruptor creates a new instance of a ServiceDisruptor that targets the given service
type ServiceDisruptorOptions ¶
type ServiceDisruptorOptions struct { // timeout when waiting agent to be injected in seconds (default 30s). A zero value forces default. // A Negative value forces no waiting. InjectTimeout int `js:"injectTimeout"` }
ServiceDisruptorOptions defines options that controls the behavior of the ServiceDisruptor