open-nomad/website/content/docs/commands/namespace/apply.mdx

74 lines
1.6 KiB
Plaintext
Raw Normal View History

2017-09-19 14:47:10 +00:00
---
2020-02-06 23:45:31 +00:00
layout: docs
page_title: 'Commands: namespace apply'
description: |
2017-09-19 14:47:10 +00:00
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.
2020-10-22 21:59:40 +00:00
~> Namespaces are open source in Nomad 1.0. Namespaces were Enterprise-only
2020-12-07 22:04:11 +00:00
when introduced in Nomad 0.7.
2017-09-19 14:47:10 +00:00
## Usage
```plaintext
nomad namespace apply [options] <input>
2017-09-19 14:47:10 +00:00
```
Apply is used to create or update a namespace. The 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.
2017-09-19 14:47:10 +00:00
If ACLs are enabled, this command requires a management ACL token.
2017-09-19 14:47:10 +00:00
## General Options
@include 'general_options_no_namespace.mdx'
2017-09-19 14:47:10 +00:00
## Apply Options
- `-quota` : An optional quota to apply to the namespace.
2017-10-13 21:36:02 +00:00
- `-description` : An optional human readable description for the namespace.
2017-09-19 14:47:10 +00:00
- `json` : Parse the input as a JSON namespace specification.
2017-09-19 14:47:10 +00:00
## Examples
Create a namespace with a quota:
2017-09-19 14:47:10 +00:00
2020-05-18 20:53:06 +00:00
```shell-session
$ nomad namespace apply -description "Prod API servers" -quota prod api-prod
2017-09-19 14:47:10 +00:00
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.json
name = "dev"
description = "Namespace for developers"
capabilities {
enabled_task_drivers = ["docker", "exec"]
disabled_task_drivers = ["raw_exec"]
}
2022-02-27 08:09:10 +00:00
meta {
owner = "John Doe"
contact_mail = "john@mycompany.com
}
$ nomad namespace apply namespace.json
```