Skip to content

Commit

Permalink
backport of commit 0a5e901 (#17900)
Browse files Browse the repository at this point in the history
This pull request was automerged via backport-assistant
  • Loading branch information
hc-github-team-nomad-core authored Jul 11, 2023
1 parent 79773a0 commit 4f0834d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
18 changes: 18 additions & 0 deletions command/namespace_apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,24 @@ meta {
input: "",
expected: &api.Namespace{},
},
{
name: "lists in node pool config are nil if not provided",
input: `
name = "nil-lists"
node_pool_config {
default = "default"
}
`,
expected: &api.Namespace{
Name: "nil-lists",
NodePoolConfiguration: &api.NamespaceNodePoolConfiguration{
Default: "default",
Allowed: nil,
Denied: nil,
},
},
},
}

for _, tc := range testCases {
Expand Down
8 changes: 4 additions & 4 deletions nomad/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5396,10 +5396,10 @@ type NamespaceNodePoolConfiguration struct {
Default string

// Allowed specifies the node pools that are allowed to be used by jobs in
// this namespace. This field supports wildcard globbing through the use
// of `*` for multi-character matching. If specified, only the node pools
// that match these patterns are allowed. This field cannot be used
// with Denied.
// this namespace. By default, all node pools are allowed. If an empty list
// is provided only the namespace's default node pool is allowed. This field
// supports wildcard globbing through the use of `*` for multi-character
// matching. This field cannot be used with Denied.
Allowed []string

// Denied specifies the node pools that are not allowed to be used by jobs
Expand Down
12 changes: 6 additions & 6 deletions website/content/docs/other-specifications/namespace.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ node_pool_config {
- `default` `(string: "default")` - Specifies the node pool to use for jobs in
this namespace that don't define a node pool in their specification.

- `allowed` `(array<string>: [])` - Specifies the node pools that are allowed
to be used by jobs in this namespace. This field supports wildcard globbing
through the use of `*` for multi-character matching. If specified, only the
node pools that match these patterns are allowed. This field cannot be used
with `denied`.
- `allowed` `(array<string>: nil)` - Specifies the node pools that are allowed
to be used by jobs in this namespace. By default, all node pools are allowed.
If an empty list is provided only the namespace's default node pool is
allowed. This field supports wildcard globbing through the use of `*` for
multi-character matching. This field cannot be used with `denied`.

- `denied` `(array<string>: [])` - Specifies the node pools that are not
- `denied` `(array<string>: nil)` - Specifies the node pools that are not
allowed to be used by jobs in this namespace. This field supports wildcard
globbing through the use of `*` for multi-character matching. If specified,
any node pool is allowed to be used, except for those that match any of these
Expand Down

0 comments on commit 4f0834d

Please sign in to comment.