conf

package
v0.0.0-...-b1a0dc5 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMaxAge is default MaxAge in seconds if one is not provided in a Criteria Object
	DefaultMaxAge = 86400

	// DefaultMinAge is the default MinAge in seconds if one is not provided in a Criteria Object
	DefaultMinAge = 90

	// DefaultStrategy is the default Strategy if one is not provided in a Criteria Object
	DefaultStrategy = StrategySpreadFast

	// DefaultLimit is the default Limit is one is not provided in a Criteria Object
	DefaultLimit = 1

	// DefaultGracePeriod is the default GracePeriod if one is not provided in a Criteria Object
	DefaultGracePeriod = 30

	// DefaultCoolDown is the default CoolDown if one is not provided in a Criteria Object
	DefaultCoolDown = 300
)
View Source
const (
	// StrategySpread attempts to spread out the kicking of pods to a evenly distributed schedule within the provided
	// MaxAge. Keep in mind that pods with ages closer then count/MaxAge may exist longer then the MaxAge.
	StrategySpread = "spread"
	// StrategySpreadFast attempts to spread out the kicking of pods to a evenly distributed schedule within the provided
	// MaxAge. This strategy premetivly kills the oldest pod once beyond a given minimum age.
	StrategySpreadFast = "spreadfast"
	// StrategyImmediate kicks any pod that is over MaxAge regardless of the state of other pods. This is a fairly
	// drastic approach and should be used with caution.
	StrategyImmediate = "immediate"
)
View Source
const (
	// DefaultCheckInterval is the default CheckInterval if one is not provided in a Conf Object
	DefaultCheckInterval = 60
)
View Source
const (
	// DefaultConfigFileName is the name the default configuration file when not specified
	DefaultConfigFileName = "kicker.yaml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	// KubeConf defines a path to a configuration file to use when connecting to the Kubernetes Cluster we are managing
	// pod kicking for. If not provided it will attempt to use one setup within the home directory of the invokeing user.
	KubeConf string `yaml:"kubeConf"`

	// CheckInterval defines the interval in seconds between kicker evaluations
	CheckInterval int64 `yaml:"checkInterval"`

	// Criteria is the set of targetting strategies for this programm to use. At least one valid criteria must be provided.
	Criteria []Criteria `yaml:"criteria"`
}

Conf is the basic configuration structure to be used by this program. It defines kubernetes config locations as well as pod kicking criteria.

func LoadConf

func LoadConf(path string) (Conf, error)

LoadConf will load the configuration file from the path specified or look for DefaultConfigFileName in the launching directory

type Criteria

type Criteria struct {
	// Name is the name of the pods used to target this Criteria.
	// This is a required field
	Name string `yaml:"name"`

	// Namespace is the namespace to use when finding and working with these pods.
	// Defaults to DefaultNamespace if left empty.
	Namespace string `yaml:"namespace"`

	// MaxAge is the maximum age in seconds that a pod should live for to be eligible for kicking.
	// Must be greater then MinAge. Defaults to DefaultMaxAge if not provided or <= 0.
	MaxAge int64 `yaml:"maxAge"`

	// MinAge is the minimum age in seconds that a pod should be alive for to before being considered eligible for
	// kicking.
	// Must be less then MaxAge. Defaults to DefaultMinAge if not provided or <= 0.
	MinAge int64 `yaml:"minAge"`

	// Strategy is the strategy used to manage which pod is kicked if needed. Defaults to DefaultStrategy
	Strategy Strategy `yaml:"strategy"`

	// Limit is the maximum count of pods that can be kicked per evaluation period. Defaults to DefaultLimit
	Limit int64 `yaml:"limit"`

	// GracePeriod is the grace period in seconds that a kicked pod will have when shutting down
	GracePeriod int64 `yaml:"gracePeriod"`

	// DefaultCoolDown is the cool down in seconds that a strategy will wait before being elidgable to kick a pod
	CoolDown int64 `yaml:"coolDown"`
}

Criteria defines a set of criteria used for targetting pods to kick.

type Strategy

type Strategy string

Strategy defines the strategy to use for kicking pods

Jump to

Keyboard shortcuts

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