Adding node_pool to job key validation (#18366)

This commit is contained in:
Pavel Aminov 2023-09-13 17:52:04 +03:00 committed by Luiz Aoqui
parent 9a188167cb
commit def93200b1
5 changed files with 7 additions and 1 deletions

3
.changelog/18366.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
jobspec: add `node_pool` as a valid field
```

View File

@ -966,7 +966,7 @@ type Job struct {
Priority *int `hcl:"priority,optional"`
AllAtOnce *bool `mapstructure:"all_at_once" hcl:"all_at_once,optional"`
Datacenters []string `hcl:"datacenters,optional"`
NodePool *string `hcl:"node_pool,optional"`
NodePool *string `mapstructure:"node_pool" hcl:"node_pool,optional"`
Constraints []*Constraint `hcl:"constraint,block"`
Affinities []*Affinity `hcl:"affinity,block"`
TaskGroups []*TaskGroup `hcl:"group,block"`

View File

@ -66,6 +66,7 @@ func parseJob(result *api.Job, list *ast.ObjectList) error {
"affinity",
"spread",
"datacenters",
"node_pool",
"group",
"id",
"meta",

View File

@ -61,6 +61,7 @@ func TestParse(t *testing.T) {
Datacenters: []string{"us2", "eu1"},
Region: stringToPtr("fooregion"),
Namespace: stringToPtr("foonamespace"),
NodePool: stringToPtr("dev"),
ConsulToken: stringToPtr("abc"),
VaultToken: stringToPtr("foo"),

View File

@ -4,6 +4,7 @@
job "binstore-storagelocker" {
region = "fooregion"
namespace = "foonamespace"
node_pool = "dev"
type = "batch"
priority = 52
all_at_once = true