chaosmonkey: Index | Files | Directories

package chaosmonkey

import ""

Package chaosmonkey contains our domain models


Package Files


type AppConfig Uses

type AppConfig struct {
    Enabled                        bool
    RegionsAreIndependent          bool
    MeanTimeBetweenKillsInWorkDays int
    MinTimeBetweenKillsInWorkDays  int
    Grouping                       Group
    Exceptions                     []Exception
    Whitelist                      *[]Exception

AppConfig contains app-specific configuration parameters for Chaos Monkey

func NewAppConfig Uses

func NewAppConfig(exceptions []Exception) AppConfig

NewAppConfig constructs a new app configuration with reasonable defaults with specified accounts enabled/disabled

type AppConfigGetter Uses

type AppConfigGetter interface {
    // Get returns the App config info by app name
    Get(app string) (*AppConfig, error)

AppConfigGetter retrieves App configuration info

type Checker Uses

type Checker interface {
    // Check checks if a termination is permitted and, if so, records the
    // termination time on the server.
    // The endHour (hour time when Chaos Monkey stops killing) is in the
    // time zone specified by loc.
    Check(term Termination, appCfg AppConfig, endHour int, loc *time.Location) error

Checker checks to see if a termination is permitted given min time between terminations

if the termination is permitted, returns (true, nil) otherwise, returns false with an error

Returns ErrViolatesMinTime if violates min time between terminations

Note that this call may change the state of the server: if the checker returns true, the termination will be recorded.

type Decryptor Uses

type Decryptor interface {
    Decrypt(ciphertext string) (string, error)

Decryptor decrypts encrypted text. It is used for decrypting sensitive credentials that are stored encrypted

type Env Uses

type Env interface {
    // InTest returns true if Chaos Monkey is running in a test environment
    InTest() bool

Env provides information about the environment that Chaos Monkey has been deployed to.

type ErrViolatesMinTime Uses

type ErrViolatesMinTime struct {
    InstanceID string         // the most recent terminated instance id
    KilledAt   time.Time      // the time that the most recent instance was terminated
    Loc        *time.Location // local time zone location

ErrViolatesMinTime represents an error when trying to record a termination that violates the min time between terminations for that particular app

func (ErrViolatesMinTime) Error Uses

func (e ErrViolatesMinTime) Error() string

type ErrorCounter Uses

type ErrorCounter interface {
    Increment() error

ErrorCounter counts when errors occur.

type Exception Uses

type Exception struct {
    Account string
    Stack   string
    Detail  string
    Region  string

Exception describes clusters that have been opted out of chaos monkey If one of the members is a "*", it matches everything. That is the only wildcard value For example, this will opt-out all of the cluters in the test account: Exception{ Account:"test", Stack:"*", Cluster:"*", Region: "*"}

func (Exception) Matches Uses

func (ex Exception) Matches(account, stack, detail, region string) bool

Matches returns true if an exception matches an ASG

type Group Uses

type Group int

Group describes what Chaos Monkey considers a group of instances Chaos Monkey will randomly kill an instance from each group. The group generally maps onto what the service owner considers a "cluster", which is different from Spinnaker's notion of a cluster.

const (
    // App grouping: Chaos Monkey kills one instance per app per day
    App Group = iota
    // Stack grouping: Chaos Monkey kills one instance per stack per day
    // Cluster grouping: Chaos Monkey kills one instance per cluster per day

func (Group) String Uses

func (g Group) String() string

String returns a string representation for a Group

type Instance Uses

type Instance interface {
    // AppName is the name of the Netflix app
    AppName() string

    // AccountName is the name of the account the instance is running in (e.g., prod, test)
    AccountName() string

    // RegionName is the name of the AWS region (e.g., us-east-1
    RegionName() string

    // StackName returns the "stack" part of app-stack-detail in cluster names
    StackName() string

    // ClusterName is the full cluster name: app-stack-detail
    ClusterName() string

    // ASGName is the name of the ASG associated with the instance
    ASGName() string

    // ID is the instance ID, e.g. i-dbcba24c
    ID() string

    // CloudProvider returns the cloud provider (e.g., "aws")
    CloudProvider() string

Instance contains naming info about an instance

type Outage Uses

type Outage interface {
    // Outage returns true if there is an ongoing outage
    Outage() (bool, error)

Outage provides an interface for checking if there is currently an outage This provides a mechanism to check if there's an ongoing outage, since Chaos Monkey doesn't run during outages

type Termination Uses

type Termination struct {
    Instance Instance  // The instance that will be terminated
    Time     time.Time // Termination time
    Leashed  bool      // If true, track the termination but do not execute it

Termination contains information about an instance termination.

type Terminator Uses

type Terminator interface {
    // Kill terminates a running instance
    Execute(trm Termination) error

Terminator provides an interface for killing instances

type Tracker Uses

type Tracker interface {
    // Track pushes a termination event to the tracking system
    Track(t Termination) error

Tracker records termination events an a tracking system such as Chronos


calPackage cal has calendar-related functions
clockPackage clock provides the Clock interface for getting the current time
commandPackage command contains functions that can be invoked via command-line e.g.
configPackage config exposes configuration information
deployPackage deploy contains information about all of the deployed instances, and how they are organized across accounts, apps, regions, clusters, and autoscaling groups.
depsPackage deps holds a set of interfaces
eligiblePackage eligible contains methods that determine which instances are eligible for Chaos Monkey termination
envPackage env contains a no-op implementation of chaosmonkey.env where InTest() always returns false
grpPackage grp holds the InstanceGroup interface
mockPackage mock contains helper functions for generating mock objects for testing
outagePackage outage provides a default no-op outage implementation
schedulePackage schedule implements a schedule of terminations
spinnakerPackage spinnaker provides an interface to the Spinnaker API
termPackage term contains the logic for terminating instances
trackerPackage tracker provides an entry point for instantiating Trackers

Package chaosmonkey imports 2 packages (graph) and is imported by 127 packages. Updated 2020-10-30. Refresh now. Tools for package owners.