docs: add node meta command docs (#16828)

* docs: add node meta command docs

Fixes #16758

* it helps if you actually add the files to git

* fix typos and examples vs usage
This commit is contained in:
Michael Schurter 2023-04-12 15:29:33 -07:00 committed by GitHub
parent 007b534020
commit 79c521e570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 155 additions and 3 deletions

View File

@ -37,10 +37,10 @@ Node Meta Apply Options:
the request will be used by default.
-unset key1,...,keyN
Unset the command separated list of keys.
Unset the comma separated list of keys.
Example:
$ nomad node meta apply -unset testing,tempvar ready=1 role=preinit-db
Example:
$ nomad node meta apply -unset testing,tempvar ready=1 role=preinit-db
`
return strings.TrimSpace(helpText)
}

View File

@ -23,9 +23,12 @@ subcommands are available:
- [`node eligibility`][eligibility] - Toggle scheduling eligibility on a given
node
- [`node meta`][meta] - Interact with node metadata
- [`node status`][status] - Display status information about nodes
[config]: /nomad/docs/commands/node/config 'View or modify client configuration details'
[drain]: /nomad/docs/commands/node/drain 'Set drain mode on a given node'
[eligibility]: /nomad/docs/commands/node/eligibility 'Toggle scheduling eligibility on a given node'
[meta]: /nomad/docs/commands/node/meta 'Interact with node metadata'
[status]: /nomad/docs/commands/node/status 'Display status information about nodes'

View File

@ -0,0 +1,41 @@
---
layout: docs
page_title: 'Commands: node meta apply'
description: |
The node meta apply command updates node metadata.
---
# Command: node meta apply
Modify a node's metadata. This command only applies to client agents, and can
be used to update the scheduling metadata the node registers.
~> Changes are batched and may take up to 10 seconds to propagate to the
servers and affect scheduling.
This command uses the [`/v1/client/metadata` HTTP API][api].
## Usage
```plaintext
nomad node meta apply [-node-id ...] [-unset ...] key1=value1 ... kN=vN
```
## General Options
@include 'general_options.mdx'
## Node Meta Apply Options
- `-node-id` - Updates metadata on the specified node. If not specified the
node receiving the request will be used by default.
- `-unset` - Unset the comma separated list of keys.
## Examples
```shell-session
$ nomad node meta apply -unset testing,tempvar ready=1 role=preinit-db
```
[api]: /nomad/api-docs/client#update-node-metadata

View File

@ -0,0 +1,29 @@
---
layout: docs
page_title: 'Commands: node meta'
description: |
The node meta commands are used to read and update node metadata.
---
# Command: node meta
The `meta` command is used to read and update node metadata. This metadata is
available for [interpolation using the `${meta.<key>}` syntax in jobs][interp].
## Usage
Usage: `nomad node meta <subcommand> [options]`
The `apply` subcommand allows for dynamically updating node metadata. The
`read` subcommand allows reading all of the metadata set on the client. All
commands interact directly with a client and allow setting a custom target with
the `-node-id` option.
Please see the individual subcommand help for detailed usage information:
- [`apply`][apply] - Modify node metadata
- [`read`][read] - Read node metadata
[interp]: /nomad/docs/runtime/interpolation#node-attributes
[apply]: /nomad/docs/commands/node/meta/apply
[read]: /nomad/docs/commands/node/meta/read

View File

@ -0,0 +1,62 @@
---
layout: docs
page_title: 'Commands: node meta read'
description: |
The node meta read command reads node metadata.
---
# Command: node meta read
Read a node's metadata. This command only works on client agents. The node
status command can be used to retrieve node metadata from any agent.
Changes via the "node meta apply" subcommand are batched and may take up to
10 seconds to propagate to the servers and affect scheduling. This command
will always return the most recent node metadata while the "node status"
command can be used to view the metadata that is currently being used for
scheduling.
This command uses the [`/v1/client/metadata` HTTP API][api].
## Usage
```plaintext
nomad node meta read [-json] [-node-id ...]
```
## General Options
@include 'general_options.mdx'
## Node Meta Read Options
- `-node-id` - Reads metadata on the specified node. If not specified the
node receiving the request will be used by default.
- `-json` - Output the node metadata in its JSON format.
- `-t` : Format and display node using a Go template.
## Example
```shell-session
$ nomad node meta read -node-id 3b58b0a6
All Meta
connect.gateway_image = envoyproxy/envoy:v${NOMAD_envoy_version}
connect.log_level = info
connect.proxy_concurrency = 1
connect.sidecar_image = envoyproxy/envoy:v${NOMAD_envoy_version}
example = a
Dynamic Meta
example = a
Static Meta
connect.gateway_image = envoyproxy/envoy:v${NOMAD_envoy_version}
connect.log_level = info
connect.proxy_concurrency = 1
connect.sidecar_image = envoyproxy/envoy:v${NOMAD_envoy_version}
```
[api]: /nomad/api-docs/client#read-node-metadata

View File

@ -649,6 +649,23 @@
"title": "eligibility",
"path": "commands/node/eligibility"
},
{
"title": "meta",
"routes": [
{
"title": "Overview",
"path": "commands/node/meta"
},
{
"title": "apply",
"path": "commands/node/meta/apply"
},
{
"title": "read",
"path": "commands/node/meta/read"
}
]
},
{
"title": "status",
"path": "commands/node/status"