Skip to content

Commit

Permalink
Adding node_pool to job key validation (#18366)
Browse files Browse the repository at this point in the history
  • Loading branch information
aminovpavel committed Sep 13, 2023
1 parent 756a22f commit 5ddada2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/18366.txt
@@ -0,0 +1,3 @@
```release-note:improvement
jobspec: add `node_pool` as a valid field
```
2 changes: 1 addition & 1 deletion api/jobs.go
Expand Up @@ -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"`
Expand Down
1 change: 1 addition & 0 deletions jobspec/parse_job.go
Expand Up @@ -66,6 +66,7 @@ func parseJob(result *api.Job, list *ast.ObjectList) error {
"affinity",
"spread",
"datacenters",
"node_pool",
"group",
"id",
"meta",
Expand Down
1 change: 1 addition & 0 deletions jobspec/parse_test.go
Expand Up @@ -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"),

Expand Down
1 change: 1 addition & 0 deletions jobspec/test-fixtures/basic.hcl
Expand Up @@ -4,6 +4,7 @@
job "binstore-storagelocker" {
region = "fooregion"
namespace = "foonamespace"
node_pool = "dev"
type = "batch"
priority = 52
all_at_once = true
Expand Down

0 comments on commit 5ddada2

Please sign in to comment.