Skip to content

Commit

Permalink
docs: add node meta command docs (#16828)
Browse files Browse the repository at this point in the history
* docs: add node meta command docs

Fixes #16758

* it helps if you actually add the files to git

* fix typos and examples vs usage
  • Loading branch information
schmichael committed Apr 12, 2023
1 parent 9898e85 commit 38d0a2f
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 3 deletions.
6 changes: 3 additions & 3 deletions command/node_meta_apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
3 changes: 3 additions & 0 deletions website/content/docs/commands/node/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
41 changes: 41 additions & 0 deletions website/content/docs/commands/node/meta/apply.mdx
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions website/content/docs/commands/node/meta/index.mdx
Original file line number Diff line number Diff line change
@@ -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
62 changes: 62 additions & 0 deletions website/content/docs/commands/node/meta/read.mdx
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions website/data/docs-nav-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 38d0a2f

Please sign in to comment.