forked from influxdata/kapacitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swarm_autoscale.go
37 lines (32 loc) · 1006 Bytes
/
swarm_autoscale.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package tick
import (
"github.com/influxdata/kapacitor/pipeline"
"github.com/influxdata/kapacitor/tick/ast"
)
// SwarmAutoscaleNode converts the swarm autoscaling pipeline node into the TICKScript AST
type SwarmAutoscaleNode struct {
Function
}
// NewSwarmAutoscale creates a SwarmAutoscale function builder
func NewSwarmAutoscale(parents []ast.Node) *SwarmAutoscaleNode {
return &SwarmAutoscaleNode{
Function{
Parents: parents,
},
}
}
// Build creates a SwarmAutoscale ast.Node
func (n *SwarmAutoscaleNode) Build(s *pipeline.SwarmAutoscaleNode) (ast.Node, error) {
n.Pipe("swarmAutoscale").
Dot("cluster", s.Cluster).
Dot("serviceName", s.ServiceNameTag).
Dot("serviceNameTag", s.ServiceNameTag).
Dot("outputServiceNameTag", s.OutputServiceNameTag).
Dot("currentField", s.CurrentField).
Dot("max", s.Max).
Dot("min", s.Min).
Dot("replicas", s.Replicas).
Dot("increaseCooldown", s.IncreaseCooldown).
Dot("decreaseCooldown", s.DecreaseCooldown)
return n.prev, n.err
}