Documentation ¶
Index ¶
Constants ¶
const ( // ScaleDirectionDown indicates the target should lower the number of running // instances of the resource. ScaleDirectionDown = iota - 1 // ScaleDirectionNone indicates no scaling is required. ScaleDirectionNone // ScaleDirectionUp indicates the target should increase the number of // running instances of the resource. ScaleDirectionUp )
The following constants are used to standardize the possible scaling directions for an Action. They are ordered from riskier to safest, with ScaleDirectionNone as the default and zero value.
const ( // MetaValueDryRunCount is a special count value used when performing // dry-run scaling activities. The Autoscaler will never set a count to a // negative value during normal operation, so the agent is safe to assume a // count set to this value implies dry-run. MetaValueDryRunCount = -1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { // Count represents the desired count of the target resource. It should // always be zero or above, expect in the event of dry-run where it can use // the MetaValueDryRunCount value. Count int64 Reason string Error bool // Direction is the scaling direction the strategy has decided should // happen. This is particularly helpful for non-Nomad target // implementations whose APIs dead with increment changes rather than // absolute counts. Direction ScaleDirection Meta map[string]interface{} }
Action represents a Strategy's intention to modify.
func PreemptAction ¶ added in v0.1.0
PreemptAction determines which Action should take precedence.
The result is based on the scaling direction and count. The order of precedence for the scaling directions is defined by the order in which they are declared in the above enum.
If the scaling direction is the same, the priority is given to the safest option, where safest is defined as lowest impact in the underlying infrastructure:
- ScaleDirectionUp: Action with highest count
- ScaleDirectionDown: Action with highest count
func (*Action) Canonicalize ¶
func (a *Action) Canonicalize()
Canonicalize ensures Action has proper default values.
type Plugin ¶
type Plugin struct {
Impl Strategy
}
Plugin is the plugin.Plugin
type RPC ¶
type RPC struct {
// contains filtered or unexported fields
}
func (*RPC) PluginInfo ¶
func (r *RPC) PluginInfo() (*base.PluginInfo, error)
type RPCServer ¶
type RPCServer struct {
Impl Strategy
}
func (*RPCServer) PluginInfo ¶
func (s *RPCServer) PluginInfo(_ interface{}, r *base.PluginInfo) error
type RunRequest ¶
type ScaleDirection ¶ added in v0.1.0
type ScaleDirection int8
ScaleDirection is an identifier used by strategy plugins to identify how the target should scale the named resource.
func (ScaleDirection) String ¶ added in v0.1.0
func (d ScaleDirection) String() string
String satisfies the Stringer interface and returns as string representation of the scaling direction.