Target Plugins
Target plugins are used by the autoscaler to retrieve information about a scaling target and also to perform a scaling action against them.
For a real-world example of a Nomad Target plugin implementation, see the
Nomad group->count
plugin.
Authoring Target Plugins
Authoring a target plugin in Go can be accomplished by implementing the
target.Target
interface, alongside a main
package to
launch the plugin.
The no-op
Target plugin can be used as a starting point for new Target
plugins.
Target Plugin API
The base plugin interface must be implemented in addition to the following functions.
Scale(action sdk.ScalingAction, config map[string]string) error
The Scale
method is called by the agent during policy evaluation. The action
argument specifies the details about the scaling action
that should be made against the target. config
includes the details about the
scaling target that were provided in the scaling policy.
Status(config map[string]string) (*sdk.TargetStatus, error)
The Status
method is called by the agent in order to determine the current
status of a scaling target. This is performed as part of policy evaluation,
and the information returned may be used by the scaling
strategy to inform the next scaling action. Information returned includes
current scaling level, readiness, and arbitrary metadata.