Skip to content

Commit

Permalink
Dispense fixed-value, pass-through, and threshold strategy plugins by…
Browse files Browse the repository at this point in the history
… default (#536)
  • Loading branch information
lgfa29 authored Nov 15, 2021
1 parent b0e2119 commit 9bb87f1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## UNRELEASED

IMPROVEMENTS:
* agent: Dispense `fixed-value`, `pass-through`, and `threshold` strategy plugins by default [[GH-536](https://github.com/hashicorp/nomad-autoscaler/pull/536)]
* policy: Prevent scaling cluster to zero when using the Nomad APM [[GH-534](https://github.com/hashicorp/nomad-autoscaler/pull/534)]
* scaleutils: Add combined filter to allow filtering by node class and datacenter [[GH-535](https://github.com/hashicorp/nomad-autoscaler/pull/535)]

Expand Down
11 changes: 8 additions & 3 deletions agent/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,14 @@ func Default() (*Agent, error) {
AckTimeout: defaultPolicyEvalAckTimeout,
Workers: defaultPolicyEvalWorkers,
},
APMs: []*Plugin{{Name: plugins.InternalAPMNomad, Driver: plugins.InternalAPMNomad}},
Strategies: []*Plugin{{Name: plugins.InternalStrategyTargetValue, Driver: plugins.InternalStrategyTargetValue}},
Targets: []*Plugin{{Name: plugins.InternalTargetNomad, Driver: plugins.InternalTargetNomad}},
APMs: []*Plugin{{Name: plugins.InternalAPMNomad, Driver: plugins.InternalAPMNomad}},
Strategies: []*Plugin{
{Name: plugins.InternalStrategyFixedValue, Driver: plugins.InternalStrategyFixedValue},
{Name: plugins.InternalStrategyPassThrough, Driver: plugins.InternalStrategyPassThrough},
{Name: plugins.InternalStrategyTargetValue, Driver: plugins.InternalStrategyTargetValue},
{Name: plugins.InternalStrategyThreshold, Driver: plugins.InternalStrategyThreshold},
},
Targets: []*Plugin{{Name: plugins.InternalTargetNomad, Driver: plugins.InternalTargetNomad}},
}, nil
}

Expand Down
14 changes: 13 additions & 1 deletion agent/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func Test_Default(t *testing.T) {
assert.Equal(t, defaultPolicyEvalWorkers, def.PolicyEval.Workers)
assert.Len(t, def.APMs, 1)
assert.Len(t, def.Targets, 1)
assert.Len(t, def.Strategies, 1)
assert.Len(t, def.Strategies, 4)
assert.Equal(t, 1*time.Second, def.Telemetry.CollectionInterval)
assert.False(t, def.EnableDebug, "ensure debugging is disabled by default")
}
Expand Down Expand Up @@ -247,10 +247,22 @@ func TestAgent_Merge(t *testing.T) {
},
},
Strategies: []*Plugin{
{
Name: "fixed-value",
Driver: "fixed-value",
},
{
Name: "pass-through",
Driver: "pass-through",
},
{
Name: "target-value",
Driver: "target-value",
},
{
Name: "threshold",
Driver: "threshold",
},
{
Name: "pid",
Driver: "pid",
Expand Down

0 comments on commit 9bb87f1

Please sign in to comment.