mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 10:55:42 +03:00
Add structs and fields to support the Nomad Pools Governance Enterprise feature of controlling node pool access via namespaces. Nomad Enterprise allows users to specify a default node pool to be used by jobs that don't specify one. In order to accomplish this, it's necessary to distinguish between a job that explicitly uses the `default` node pool and one that did not specify any. If the `default` node pool is set during job canonicalization it's impossible to do this, so this commit allows a job to have an empty node pool value during registration but sets to `default` at the admission controller mutator. In order to guarantee state consistency the state store validates that the job node pool is set and exists before inserting it.
79 lines
1.8 KiB
Plaintext
79 lines
1.8 KiB
Plaintext
---
|
|
layout: docs
|
|
page_title: 'Commands: namespace apply'
|
|
description: |
|
|
The namespace apply command is used create or update a namespace.
|
|
---
|
|
|
|
# Command: namespace apply
|
|
|
|
The `namespace apply` command is used create or update a namespace.
|
|
|
|
<Tip>
|
|
Visit the <a href="https://developer.hashicorp.com/nomad/tutorials/manage-clusters/namespaces">
|
|
Nomad Namespaces tutorial
|
|
</a> for more information.
|
|
</Tip>
|
|
|
|
## Usage
|
|
|
|
```plaintext
|
|
nomad namespace apply [options] <input>
|
|
```
|
|
|
|
Apply is used to create or update a namespace. The HCL specification file
|
|
will be read from stdin by specifying "-", otherwise a path to the file is
|
|
expected.
|
|
|
|
Instead of a file, you may instead pass the namespace name to create
|
|
or update as the only argument.
|
|
|
|
If ACLs are enabled, this command requires a management ACL token. In federated
|
|
clusters, the namespace will be created in the authoritative region and will be
|
|
replicated to all federated regions.
|
|
|
|
## General Options
|
|
|
|
@include 'general_options_no_namespace.mdx'
|
|
|
|
## Apply Options
|
|
|
|
- `-quota` : An optional quota to apply to the namespace.
|
|
|
|
- `-description` : An optional human readable description for the namespace.
|
|
|
|
- `-json` : Parse the input as a JSON namespace specification.
|
|
|
|
## Examples
|
|
|
|
Create a namespace with a quota:
|
|
|
|
```shell-session
|
|
$ nomad namespace apply -description "Prod API servers" -quota prod api-prod
|
|
Successfully applied namespace "api-prod"!
|
|
```
|
|
|
|
Remove a quota from a namespace:
|
|
|
|
```shell-session
|
|
$ nomad namespace apply -quota= api-prod
|
|
```
|
|
|
|
Create a namespace from a file:
|
|
```shell-session
|
|
$ cat namespace.hcl
|
|
name = "dev"
|
|
description = "Namespace for developers"
|
|
|
|
capabilities {
|
|
enabled_task_drivers = ["docker", "exec"]
|
|
disabled_task_drivers = ["raw_exec"]
|
|
}
|
|
|
|
meta {
|
|
owner = "John Doe"
|
|
contact_mail = "john@mycompany.com"
|
|
}
|
|
$ nomad namespace apply namespace.hcl
|
|
```
|