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
»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.
no-op Target plugin can be used as a starting point for new Target
»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
Scale method is called by the agent during policy evaluation. The
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)
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.