52 Commits

Author SHA1 Message Date
Tim Gross
8a5a057d88 offline license utilization reporting (#25844)
Nomad Enterprise users operating in air-gapped or otherwise secured environments
don't want to send license reporting metrics directly from their
servers. Implement manual/offline reporting by periodically recording usage
metrics snapshots in the state store, and providing an API and CLI by which
cluster administrators can download the snapshot for review and out-of-band
transmission to HashiCorp.

This is the CE portion of the work required for implemention in the Enterprise
product. Nomad CE does not perform utilization reporting.

Ref: https://github.com/hashicorp/nomad-enterprise/pull/2673
Ref: https://hashicorp.atlassian.net/browse/NMD-68
Ref: https://go.hashi.co/rfc/nmd-210
2025-05-14 09:51:13 -04:00
Tim Gross
27caae2b2a api: make attempting to remove peer by address a no-op (#25599)
In Nomad 1.4.0 we removed support for Raft Protocol v2 entirely. But the
`Operator.RemoveRaftPeerByAddress` RPC handler was left in place, along with its
supporting HTTP API and command line flags. Using this API will always result in
the Raft library error "operation not supported with current protocol version".

Unfortunately it's still possible in unit tests to exercise this code path, and
these tests are quite flaky. This changeset turns the RPC handler and HTTP API
into a no-op, removes the associated command line flags, and removes the flaky
tests. I've also cleaned up the test for `RemoveRaftPeerByID` to consolidate
test servers and use `shoenig/test`.

Fixes: https://hashicorp.atlassian.net/browse/NET-12413
Ref: https://github.com/hashicorp/nomad/pull/13467
Ref: https://developer.hashicorp.com/nomad/docs/upgrade/upgrade-specific#raft-protocol-version-2-unsupported
Ref: https://github.com/hashicorp/nomad-enterprise/actions/runs/13201513025/job/36855234398?pr=2302
2025-04-10 09:19:25 -04:00
Luiz Aoqui
e1e80f383e vault: add new nomad setup vault -check commmand (#19720)
The new `nomad setup vault -check` commmand can be used to retrieve
information about the changes required before a cluster is migrated from
the deprecated legacy authentication flow with Vault to use only
workload identities.
2024-01-12 15:48:30 -05:00
James Rasell
5a00440b06 api: Fix operator snapshot API streaming. (#19608) 2024-01-05 14:33:39 +00:00
Luiz Aoqui
e4e70b086a ci: run linter in ./api package (#19513) 2023-12-19 15:59:47 -05:00
Charlie Voiselle
8a93ff3d2d [server] Directed leadership transfer CLI and API (#17383)
* Add directed leadership transfer func
* Add leadership transfer RPC endpoint
* Add ACL tests for leadership-transfer endpoint
* Add HTTP API route and implementation
* Add to Go API client
* Implement CLI command
* Add documentation
* Add changelog

Co-authored-by: Tim Gross <tgross@hashicorp.com>
2023-10-04 12:20:27 -04:00
Charlie Voiselle
fc9076731c [api] Return a shapely error for unexpected response (#16743)
* Add UnexpectedResultError to nomad/api

This allows users to perform additional status-based behavior by rehydrating the error using `errors.As` inside of consumers.
2023-05-22 11:45:31 -04:00
hashicorp-copywrite[bot]
f005448366 [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
Lance Haig
0e74431b01 Update ioutil library references to os and io respectively for API and Plugins package (#16330)
No user facing changes so I assume no change log is required
2023-03-08 10:25:09 -06:00
Michael Schurter
6809b0b527 Dynamic Node Metadata (#15844)
Fixes #14617
Dynamic Node Metadata allows Nomad users, and their jobs, to update Node metadata through an API. Currently Node metadata is only reloaded when a Client agent is restarted.

Includes new UI for editing metadata as well.

---------

Co-authored-by: Phil Renaud <phil.renaud@hashicorp.com>
2023-02-07 14:42:25 -08:00
Piotr Kazmierczak
949a6f60c7 renamed stanza to block for consistency with other projects (#15941) 2023-01-30 15:48:43 +01:00
James Rasell
24220d0a02 core: allow pausing and un-pausing of leader broker routine (#13045)
* core: allow pause/un-pause of eval broker on region leader.

* agent: add ability to pause eval broker via scheduler config.

* cli: add operator scheduler commands to interact with config.

* api: add ability to pause eval broker via scheduler config

* e2e: add operator scheduler test for eval broker pause.

* docs: include new opertor scheduler CLI and pause eval API info.
2022-07-06 16:13:48 +02:00
Luiz Aoqui
86e2dd718c api: return error when LicenseGet status is not 200 (#11644) 2021-12-14 19:47:09 -05:00
Tim Gross
2c3db7ee1d scheduler: config option to reject job registration (#11610)
During incident response, operators may find that automated processes
elsewhere in the organization can be generating new workloads on Nomad
clusters that are unable to handle the workload. This changeset adds a
field to the `SchedulerConfiguration` API that causes all job
registration calls to be rejected unless the request has a management
ACL token.
2021-12-06 15:20:34 -05:00
Luiz Aoqui
89447fb42e Revert "Return SchedulerConfig instead of SchedulerConfigResponse struct (#10799)" (#11433) 2021-11-02 17:42:52 -04:00
Charlie Voiselle
8ba714e211 Return SchedulerConfig instead of SchedulerConfigResponse struct (#10799) 2021-10-13 21:23:13 -04:00
Seth Hoenig
61ee443ee6 core: implement system batch scheduler
This PR implements a new "System Batch" scheduler type. Jobs can
make use of this new scheduler by setting their type to 'sysbatch'.

Like the name implies, sysbatch can be thought of as a hybrid between
system and batch jobs - it is for running short lived jobs intended to
run on every compatible node in the cluster.

As with batch jobs, sysbatch jobs can also be periodic and/or parameterized
dispatch jobs. A sysbatch job is considered complete when it has been run
on all compatible nodes until reaching a terminal state (success or failed
on retries).

Feasibility and preemption are governed the same as with system jobs. In
this PR, the update stanza is not yet supported. The update stanza is sill
limited in functionality for the underlying system scheduler, and is
not useful yet for sysbatch jobs. Further work in #4740 will improve
support for the update stanza and deployments.

Closes #2527
2021-08-03 10:30:47 -04:00
Mahmood Ali
9d86a5277d api: actually set MemoryOversubscriptionEnabled (#10493) 2021-05-02 22:53:53 -04:00
Mahmood Ali
1d60aa667f Merge pull request #10276 from hashicorp/b-api-operator-query-meta
api: set operator query meta

Set the query meta for LicenseGet request. It's expected by api consumers to determine the raft index.
2021-04-12 13:30:24 -04:00
Drew Bailey
af00546d2d allow setting stale flag from cli to retrieve individual server license (#10300) 2021-04-05 15:35:14 -04:00
Mahmood Ali
1df9984a03 api: set operator query meta 2021-03-31 15:52:44 -04:00
Drew Bailey
4484d361ee configuration and oss components for licensing (#10216)
* configuration and oss components for licensing

* vendor sync
2021-03-23 09:08:14 -04:00
Buck Doyle
288e50ad32 Add handling for license requests in OSS (#9963)
This changes the license-fetching endpoint to respond with 204 in
OSS instead of 501. It closes #9827.
2021-02-08 12:53:06 -06:00
Dave May
71a022ad8c Metrics gotemplate support, debug bundle features (#9067)
* add goroutine text profiles to nomad operator debug

* add server-id=all to nomad operator debug

* fix bug from changing metrics from string to []byte

* Add function to return MetricsSummary struct, metrics gotemplate support

* fix bug resolving 'server-id=all' when no servers are available

* add url to operator_debug tests

* removed test section which is used for future operator_debug.go changes

* separate metrics from operator, use only structs from go-metrics

* ensure parent directories are created as needed

* add suggested comments for text debug pprof

* move check down to where it is used

* add WaitForFiles helper function to wait for multiple files to exist

* compact metrics check

Co-authored-by: Drew Bailey <2614075+drewbailey@users.noreply.github.com>

* fix github's silly apply suggestion

Co-authored-by: Drew Bailey <2614075+drewbailey@users.noreply.github.com>
2020-10-14 15:16:10 -04:00
davemay99
ff1578f0f3 added comment to operator metrics function 2020-10-06 11:22:10 -04:00
davemay99
ec09c593b5 metrics return bytes instead of string for more flexibility 2020-10-06 10:49:15 -04:00
davemay99
bf8bdc94f8 Add metrics command / output to debug bundle 2020-10-05 22:30:01 -04:00
Drew Bailey
ef7b7b2a9b allow raw body instead of JSON encoded string (#8211) 2020-06-19 10:57:09 -04:00
Mahmood Ali
867147c90e api: add snapshot restore 2020-06-07 15:47:07 -04:00
Mahmood Ali
3b04afee2e Merge pull request #8047 from hashicorp/f-snapshot-save
API for atomic snapshot backups
2020-06-01 07:55:16 -04:00
Drew Bailey
43ab5cd7ed Revert "disable license cli commands" 2020-05-26 12:39:39 -04:00
Mahmood Ali
1bec2425b0 Add api/ package function to save snapshot 2020-05-21 20:04:38 -04:00
Drew Bailey
9dca54c45d remove tags from api struct 2020-05-11 16:38:35 -04:00
Drew Bailey
92e8e1ace2 disable license cli commands 2020-05-11 13:49:29 -04:00
Drew Bailey
d5f99a06e2 update license command output to reflect api changes 2020-05-05 10:28:58 -04:00
Mahmood Ali
5078e0cfed tests and some clean up 2020-05-01 13:13:30 -04:00
Charlie Voiselle
6571ccefbc Add SchedulerAlgorithm to SchedulerConfig 2020-05-01 13:13:29 -04:00
Drew Bailey
3876c1a68d add license reset command to commands
help text formatting

remove reset

no signed option
2020-04-30 14:46:20 -04:00
Drew Bailey
8b222d79d5 license cli commands
cli changes, formatting
2020-04-30 14:46:17 -04:00
Preetha Appan
a9d45c5048 Rename to match system scheduler config.
Also added docs
2019-05-03 14:06:12 -05:00
Preetha Appan
c9edc45661 Add config to disable preemption for batch/service jobs 2019-04-29 18:48:07 -05:00
Preetha Appan
3eeb229116 change path to v1/scheduler/configuration 2018-11-12 15:57:45 -06:00
Preetha Appan
1fe9203aa6 Use response object/querymeta/writemeta in scheduler config API 2018-11-10 10:31:10 -06:00
Preetha Appan
88005852e3 Introduce a response object for scheduler configuration 2018-10-30 11:06:32 -05:00
Preetha Appan
6966e3c3e8 Make preemption config a struct to allow for enabling based on scheduler type 2018-10-30 11:06:32 -05:00
Preetha Appan
784b96c104 Support for new scheduler config API, first use case is to disable preemption 2018-10-30 11:06:32 -05:00
Josh Soref
cc582be46e spelling: configuration 2018-03-11 17:48:04 +00:00
Kyle Havlovitz
254458703b Add raft remove by id endpoint/command 2018-01-16 13:35:32 -08:00
Kyle Havlovitz
de90db139a Added support for v2 raft APIs and -raft-protocol option 2017-12-12 10:17:16 -06:00
Alex Dadgar
a9e3a41407 Enable more linters 2017-09-26 15:26:33 -07:00