Documentation
¶
Index ¶
- type Direction
- type GroupReq
- type Scale
- type Scaler
- func (s *Scaler) GetDeploymentChannel() chan interface{}
- func (s *Scaler) JobGroupIsDeploying(job, group string) bool
- func (s *Scaler) JobGroupIsInCooldown(job, group string, cooldown int, time int64) (bool, error)
- func (s *Scaler) RunDeploymentUpdateHandler()
- func (s *Scaler) Trigger(jobID string, groupReqs []*GroupReq, source state.Source) (*ScalingResponse, int, error)
- type ScalingResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GroupReq ¶
type GroupReq struct { // Direction is the scaling direction which the group is requested to change. Direction Direction // Count is the number by which to change the count by in the desired direction. This // information can also be found within the GroupScalingPolicy, but the API and the internal // autoscaler have different ways in which to process data so it is their responsibility to // populate this field for use and moves this logic away from the trigger. Count int // GroupName is the name of the job group to scale in this request. GroupName string // GroupScalingPolicy should include the job group scaling policy if it exists within the // Sherpa server. GroupScalingPolicy *policy.GroupScalingPolicy // Time is the UnixNano time representation which indicates when this scaling request was first // triggered. This is to help coordinate with checks such as cooldown and ensure a single time // can be used. Time int64 // Meta is the meta data which is optionally submitted when requesting a scaling activity for a // job group. This is free-form and can contain any information the user deems relevant. Meta map[string]string }
GroupReq is a single item of scaling information for a single job group.
func (*GroupReq) MarshalZerologObject ¶
type Scale ¶
type Scale interface { // Trigger performs scaling of 1 or more job groups which belong to the same job. Trigger(string, []*GroupReq, state.Source) (*ScalingResponse, int, error) // GetDeploymentChannel is used to return the channel where updates to Nomad deployments should // be sent. GetDeploymentChannel() chan interface{} // RunDeploymentUpdateHandler is used to trigger the long running process which handles // messages sent to the deployment update channel. RunDeploymentUpdateHandler() // JobGroupIsDeploying checks internal references to identify if the queried job group is // currently in deployment. JobGroupIsDeploying(job, group string) bool // JobGroupIsInCooldown checks whether the job group in question is currently in scaling // cooldown using the input time as the comparison. JobGroupIsInCooldown(job, group string, cooldown int, time int64) (bool, error) // contains filtered or unexported methods }
Scale is the interface used for scaling a Nomad job.
type Scaler ¶
type Scaler struct {
// contains filtered or unexported fields
}
func (*Scaler) GetDeploymentChannel ¶ added in v0.2.0
func (s *Scaler) GetDeploymentChannel() chan interface{}
GetDeploymentChannel will return the channel where deployment updates should be sent.
func (*Scaler) JobGroupIsDeploying ¶ added in v0.2.0
JobGroupIsDeploying returns a boolean to indicate where or not the specified job and group is currently in deployment.
func (*Scaler) JobGroupIsInCooldown ¶ added in v0.3.0
JobGroupIsInCooldown satisfies the JobGroupIsInCooldown func within the Scale interface.
func (*Scaler) RunDeploymentUpdateHandler ¶ added in v0.2.0
func (s *Scaler) RunDeploymentUpdateHandler()
RunDeploymentUpdateHandler is used to handle updates and shutdowns when monitoring Nomad job deployments.
func (*Scaler) Trigger ¶
func (s *Scaler) Trigger(jobID string, groupReqs []*GroupReq, source state.Source) (*ScalingResponse, int, error)
Trigger performs scaling of 1 or more job groups which belong to the same job.
The return values indicate:
- the Nomad API job register response
- the HTTP return code, used for the Sherpa API
- any error