Strategy Plugins
Strategy plugins are used by the autoscaler to implement the logic of scaling strategy. They typically consume metrics from the configured APM plugin and the current scaling value from the target plugin and compute a new desired value for the scaling target.
For a real-world example of a Nomad strategy plugin implementation, see the
target-value
plugin.
Authoring Strategy Plugins
Authoring a strategy plugin in Go can be accomplished by implementing the
strategy.Strategy
interface, alongside a main
package to launch the plugin.
The no-op
Strategy plugin can be used as a starting point for new Strategy
plugins.
Strategy Plugin API
The base plugin interface must be implemented in addition to the following functions.
Run(eval *sdk.ScalingCheckEvaluation, count int64) (*sdk.ScalingCheckEvaluation, error)
The Run
function is called by the agent during policy
evaluation. The eval
argument contains information
about the current policy evaluation, including the policy specification and the metrics from the APM. The count
argument includes the current value of the scaling target. The returned struct should include the result
from applying the strategy.