Documentation ¶
Index ¶
- Constants
- type AutoScalingGroup
- func (asg *AutoScalingGroup) AddMetrics(node ID, metrics MetricSeries) error
- func (asg *AutoScalingGroup) AddNode(node *Node) error
- func (asg *AutoScalingGroup) ChangePolicy(policy Policy) error
- func (asg *AutoScalingGroup) Evaluate() error
- func (asg *AutoScalingGroup) Execute() error
- func (asg *AutoScalingGroup) Remove() error
- func (asg *AutoScalingGroup) RemoveNode(node ID) error
- func (asg *AutoScalingGroup) Run() error
- func (asg *AutoScalingGroup) Setup(nodes NodeSet, policies PolicySet) error
- func (asg *AutoScalingGroup) Stop() error
- type AutoScalingGroupSet
- type BaseCommand
- type BaseCommands
- type CMDError
- type Command
- type CommandSet
- type CommandState
- type DesiredHealthyNodeAmountPerProviderPolicy
- type HealthMetric
- type ID
- type Launch
- type LaunchLocal
- type Metric
- type MetricSeries
- type MetricType
- type MultiSupervisor
- type NIFaces
- type NetworkInterface
- type Node
- func (n *Node) AddMetrics(metrics MetricSeries) error
- func (n *Node) CalculateMetricValue(metricType MetricType, from, to time.Time) float64
- func (n *Node) ChangeNetworkInterfaces(prIface, puIface *NetworkInterface) error
- func (n *Node) ChangeState(State NodeState) error
- func (n *Node) Remove() error
- func (n *Node) Setup(id ID, provider Provider, prIface, puIface NetworkInterface) error
- func (n *Node) UpdateProvider(provider Provider) error
- type NodeSet
- type NodeState
- type Order
- type Policy
- type PolicySet
- type Provider
- type Relaunch
- type RelaunchLocal
- type State
- type Terminate
- type TerminateLocal
- type TokenSource
Constants ¶
const ( Local = "local" DigitalOcean = "digitalocean" Linoid = "linoid" Vultr = "vultr" NodeStateNew = NodeState(0) NodeStateActive = NodeState(1) NodeStateUnhealthy = NodeState(2) NodeStateTerminated = NodeState(4) NodeStateDeleted = NodeState(8) ASGStateNew = State(0) ASGStateActive = State(1) ASGStateExecuting = State(2) ASGStateDeleted = State(4) CMDStateNew = CommandState(0) CMDStateInProgress = CommandState(1) CMDStateDone = CommandState(2) CMDStateFailed = CommandState(4) HealthMetricType MetricType = "health" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoScalingGroup ¶
type AutoScalingGroup struct { ID ID State State Nodes NodeSet Policies PolicySet Commands CommandSet // contains filtered or unexported fields }
AutoScalingGroup ...
func NewAutoScalingGroup ¶
func NewAutoScalingGroup(id ID) *AutoScalingGroup
NewAutoScalingGroup constructor
func (*AutoScalingGroup) AddMetrics ¶
func (asg *AutoScalingGroup) AddMetrics(node ID, metrics MetricSeries) error
AddMetrics ...
func (*AutoScalingGroup) AddNode ¶
func (asg *AutoScalingGroup) AddNode(node *Node) error
AddNode ...
func (*AutoScalingGroup) ChangePolicy ¶
func (asg *AutoScalingGroup) ChangePolicy(policy Policy) error
ChangePolicy changes the policy, currently it overrides it and all state is lost
func (*AutoScalingGroup) Evaluate ¶
func (asg *AutoScalingGroup) Evaluate() error
Evaluate goes through the policies and generates commands that needs to be executed
func (*AutoScalingGroup) Execute ¶
func (asg *AutoScalingGroup) Execute() error
Execute required commands created by policies
func (*AutoScalingGroup) RemoveNode ¶
func (asg *AutoScalingGroup) RemoveNode(node ID) error
RemoveNode ...
func (*AutoScalingGroup) Run ¶
func (asg *AutoScalingGroup) Run() error
Run ASG and start monitoring nodes
type AutoScalingGroupSet ¶
type AutoScalingGroupSet map[ID]*AutoScalingGroup
AutoScalingGroupSet type
func NewAutoScalingGroupSet ¶
func NewAutoScalingGroupSet(asgs ...*AutoScalingGroup) AutoScalingGroupSet
NewAutoScalingGroupSet constructor
type BaseCommand ¶
type BaseCommand struct { Provider Provider State CommandState Error *CMDError Timeout time.Duration }
type BaseCommands ¶
type BaseCommands []BaseCommand
type Command ¶
type Command interface {
Execute(*AutoScalingGroup) error
}
type CommandSet ¶
func NewCommandSet ¶
func NewCommandSet(cmd ...Command) CommandSet
func (CommandSet) Merge ¶
func (cs CommandSet) Merge(newSet CommandSet)
type CommandState ¶
type CommandState int
type DesiredHealthyNodeAmountPerProviderPolicy ¶
type DesiredHealthyNodeAmountPerProviderPolicy struct { ID ID Min, Max, Desired, Current int HealthyThreshold float64 CheckInterval time.Duration Provider Provider ConsecutiveChecks int ConsecutiveChecksNum map[ID]int }
DesiredNodeAmountPerProviderPolicy evaluates current state and creates Commands per provider
func (*DesiredHealthyNodeAmountPerProviderPolicy) Evaluate ¶
func (dsp *DesiredHealthyNodeAmountPerProviderPolicy) Evaluate(asg *AutoScalingGroup) error
Evaluate what commands should be executed by given ASG
func (*DesiredHealthyNodeAmountPerProviderPolicy) GetID ¶
func (dsp *DesiredHealthyNodeAmountPerProviderPolicy) GetID() ID
func (*DesiredHealthyNodeAmountPerProviderPolicy) Update ¶
func (dsp *DesiredHealthyNodeAmountPerProviderPolicy) Update(plc Policy) error
Update will reset checks state
type HealthMetric ¶
HealthMetric metric
type Launch ¶
type Launch struct {
BaseCommand
}
func (*Launch) Execute ¶
func (lc *Launch) Execute(asg *AutoScalingGroup) error
type LaunchLocal ¶
type LaunchLocal struct {
BaseCommand
}
func (*LaunchLocal) Execute ¶
func (lc *LaunchLocal) Execute(asg *AutoScalingGroup) error
type MetricSeries ¶
MetricSeries type
type MetricType ¶
type MetricType string
type MultiSupervisor ¶
MultiSupervisor manages multiple ASG
func MakeMultiSupervisor ¶
func MakeMultiSupervisor() *MultiSupervisor
MakeMultiSupervisor creates new supervisor that supports multiple ASG
func (*MultiSupervisor) Add ¶
func (s *MultiSupervisor) Add(asg *AutoScalingGroup)
Add new ASG to run
type NIFaces ¶
type NIFaces []NetworkInterface
type NetworkInterface ¶
type Node ¶
type Node struct { ID ID Provider Provider PrivateIface NetworkInterface PublicIface NetworkInterface State NodeState Metrics MetricSeries KeepMetricFor time.Duration }
Node type
func (*Node) CalculateMetricValue ¶
func (n *Node) CalculateMetricValue(metricType MetricType, from, to time.Time) float64
CalculateMetricValue calculates avg of requested metric
func (*Node) ChangeNetworkInterfaces ¶
func (n *Node) ChangeNetworkInterfaces(prIface, puIface *NetworkInterface) error
ChangeNetworkInterfaces ...
func (*Node) Setup ¶
func (n *Node) Setup(id ID, provider Provider, prIface, puIface NetworkInterface) error
Create new node
func (*Node) UpdateProvider ¶
ChangeProvider ...
type Policy ¶
type Policy interface { // Evaluate takes in AutoScalingGroup and calculates what commands should be added or removed Evaluate(*AutoScalingGroup) error Update(Policy) error GetID() ID }
Policy type
type Relaunch ¶
type Relaunch struct { BaseCommand NodeID ID }
func (*Relaunch) Execute ¶
func (lc *Relaunch) Execute(asg *AutoScalingGroup) error
type RelaunchLocal ¶
type RelaunchLocal struct { BaseCommand NodeID ID }
func (*RelaunchLocal) Execute ¶
func (lc *RelaunchLocal) Execute(asg *AutoScalingGroup) error
type Terminate ¶
type Terminate struct { BaseCommand NodeID ID }
func (*Terminate) Execute ¶
func (lc *Terminate) Execute(asg *AutoScalingGroup) error
type TerminateLocal ¶
type TerminateLocal struct { BaseCommand NodeID ID }
func (*TerminateLocal) Execute ¶
func (lc *TerminateLocal) Execute(asg *AutoScalingGroup) error
type TokenSource ¶
type TokenSource struct {
AccessToken string
}