Commit Graph

25370 Commits

Author SHA1 Message Date
Phil Renaud
d104432cd3 Actions: API, command, and jobspec docs (#19166)
* API command and jobspec docs

* PR comments addressed

* API docs for job/jobid/action socket

* Removing a perhaps incorrect origin of job_id across the jobs api doc

* PR comments addressed
2023-11-30 14:13:37 -05:00
Piotr Kazmierczak
67bbcc4a4f cli: setup consul proper ns handling (#19237)
In order to correctly handle Consul namespaces, auth methods and binding rules
must always be created in the default namespace only.

---------

Co-authored-by: Luiz Aoqui <luiz@hashicorp.com>
2023-11-30 20:09:19 +01:00
Piotr Kazmierczak
e57dcdf106 docs: adjust claim mappings for Consul auth method (#19244) 2023-11-30 20:01:18 +01:00
James Rasell
81249ffe65 agent: log using error keyword not err in keyring endpoint (#19243) 2023-11-30 16:40:13 +00:00
Daniel Bennett
639c3f53c9 e2e: give node drain KillTimeout test more time (#19226)
and error more verbosely if it fails

also, add extra information to a failed evaluation
for more error visibility in other tests

---------

Co-authored-by: Juanadelacuesta <juanita.delacuestamorales@hashicorp.com>
2023-11-30 10:37:20 -06:00
Tim Gross
13eda8bfdd consul: respect task-level namespace when checking permissions (#19236)
In the legacy Consul token workflow, we check the user's token's permissions in
Consul at the time of job submit. The new task-level `consul` block was not
being respected when checking the list of namespaces.
2023-11-30 11:14:12 -05:00
Tim Gross
79c74bf125 service hook: get correct NS for task-level consul (#19242)
Ensure that the `ServiceProviderNamespace` correctly picks the task-level
`consul.namespace` and falls back to the group if set.
2023-11-30 11:13:47 -05:00
Tim Gross
ae403dcb4b script_check_hook: handle task-level Consul namespace (#19241)
The `script_check_hook` runs at the task level but can create script checks for
both task-level services and group-level services. Now that we allow the Consul
namespace to be set at the task-level `consul.namespace`, we need to have both
possible namespaces handy when creating and updating checks.
2023-11-30 11:13:30 -05:00
Luiz Aoqui
1a2d41d30b consul: refactor allocrunner consul hook (#19229)
Refactor the JWT token derivation logic to only take a single request
since it was only ever called with a map of length one.

The original implementation received multiple requets to match the
legacy flow, but but legacy flow requests were batched from the Nomad
client to the server, which doesn't happen for JWT. Each JWT request
goes directly from the Nomad client to the Consul agent, so there is no
batching involved.
2023-11-30 10:55:03 -05:00
Luiz Aoqui
e741e93304 identity: add Consul and Vault namespace claims (#19228)
Token claims are used in several dynamic configuration in Consul and
Vault, such as Consul ACL bind and namespace rules, and Vault templated
policies.

Adding a claim for the Consul and Vault namespace defined for the
service or task allows cluster operators to create more flexible and
precise rules.

The `consul_namespace` claim is added to workload identities for Consul
services and to task workload identities that have the `consul_` name
prefix and are affected by a task or group `consul` block.

The `vault_namespace` claim is added to task workload identities that
have the `vault_` name prefix and are affected by a `vault` block.
2023-11-30 10:41:32 -05:00
Phil Renaud
7ab7edf9cd [ui] Display job plan warnings alongside dry run info when attempting to run a job through the web UI (#19225)
* init

* Warnings shown at plan stage

* testfixes for new hds class

* New tests for warning block presence
2023-11-30 10:41:23 -05:00
Seth Hoenig
5f3aae7340 website: fix spellcheck path and cleanup some misspellings (#19238) 2023-11-30 09:38:19 -06:00
Piotr Kazmierczak
d699b82df6 docs: update consul-integration to include ns changes (#19239)
Co-authored-by: Tim Gross <tgross@hashicorp.com>
2023-11-30 16:37:48 +01:00
Luiz Aoqui
59aa860c13 scheduler: fix task-level consul diff (#19230)
Fix `tasksUpdated()` to compare the task level `consul` blocks instead
of the group.
2023-11-30 10:13:17 -05:00
Luiz Aoqui
969cdb0f46 test: add consul namespace rules to consulcompat (#19227)
When configuring Consul for multi-namespace support, the JWT auth method
needs to specify namespace rules. This attribute is set to `nil` in CE
but is used in Nomad ENT.
2023-11-30 10:13:08 -05:00
James Rasell
573c3103fb docs: add job stop no_shutdown_delay API query param entry (#19215) 2023-11-30 07:28:35 +00:00
Tim Gross
f77b4baebb service_hook: ensure task-level consul.namespace is respected (#19224)
The task-level service hook is using the group-level method to get the provider
namespace, but this was not designed with task-level `consul` blocks in
mind. This leads to task-level services using the group-level
`consul.namespace`. Fix by creating a method to get the correct namespace and
move this into the service hook itself rather than in the outer `initHooks`
method.
2023-11-29 16:46:27 -05:00
Luiz Aoqui
d29ac461a7 cli: non-service jobs on job restart -reschedule (#19147)
The `-reschedule` flag stops allocations and assumes the Nomad scheduler
will create new allocations to replace them. But this is only true for
service and batch jobs.

Restarting non-service jobs with the `-reschedule` flag causes the
command to loop forever waiting for the allocations to be replaced,
which never happens.

Allocations for system jobs may be replaced by triggering an evaluation
after each stop to cause the reconciler to run again.

Sysbatch jobs should not be allowed to be rescheduled as they are never
replaced by the scheduler.
2023-11-29 13:01:19 -05:00
Tim Gross
4e7ad58d2d E2E: modernize ConsulTemplate test and fix some assertions (#19126)
The `TestTemplateUpdateTriggers` is flaky because of what turned out to be
incompatibility between the Consul agent on the E2E cluster and the HCP Consul
server we were running but hadn't upgraded in a while. Upgrading the HCP Consul
server seems to have fixed the tests, but while I'm in here I've updated this
test suite:

* Port all the consul template test suite off of the old framework, and upgrade to
  using e2e "v3" where feasible.
* Clean up some of the assertions in the update triggers test to make the
  purpose of the test more clear.
* Remove unnecessary default fields from the job specs.

Closes: #19075
2023-11-29 12:16:41 -05:00
James Rasell
0819aab237 cli: fix help formatting on job stop command. (#19214) 2023-11-29 15:52:37 +00:00
Piotr Kazmierczak
26b778bb0c docs: correction to Consul integration TLS note (#19207) 2023-11-28 19:22:02 +01:00
Luiz Aoqui
ddb060d8b3 deps: update go-metrics to v0.5.3 (#19190)
Update `go-metrics` to v0.5.3 to pick
https://github.com/hashicorp/go-metrics/pull/146.
2023-11-28 12:37:57 -05:00
Tim Gross
cbf06320cb LICENSE: fix version in license (#19203)
In #19194 the license was incorrectly changed to say that Nomad 1.6.2 or later
was under the BUSL, when in fact Nomad 1.6.2 and 1.6.3 are MPL2 licensed. Fix
this so that the correct (next!) version is shown as covered only.
2023-11-28 12:33:03 -05:00
Tim Gross
8ab7ab0db4 docs: fix typos and markdown issues on CPU concepts page (#19205) 2023-11-28 11:27:27 -05:00
Daniel Bennett
f7adcefbb3 e2e: refactor vault secrets test (#19152)
fixes VaultSecrets test - it was failing due to a
regex mismatch (`^job` stopped matching when
copywrite headers got prepended to the jobspec).

but RegisterFromJobspec (which had the bug)
was only used in the one spot, so instead this
refactors the whole test to the v3 format
with testing.T and some additional fun stuff
that we can take advantage of with it.

some improvements:
* use a namespace
* use and extend existing test helpers
* add more test helpers
2023-11-28 10:00:27 -06:00
Piotr Kazmierczak
6a98e45c53 client: add metadata to tokens requested by Consul client (#19196)
This way tokens created by Nomad workloads are easier to keep track of.
2023-11-28 16:09:31 +01:00
James Rasell
e2487698e6 docs: add alloc metrics note about possible cgroup variations. (#19195) 2023-11-28 14:32:08 +00:00
hc-github-team-es-release-engineering
07b4dde926 Update LICENSE (#19194) 2023-11-28 09:21:41 -05:00
Jorge Marey
5f78940911 Allow setting a token name template on auth methods (#19135)
Co-authored-by: James Rasell <jrasell@hashicorp.com>
2023-11-28 12:26:21 +00:00
Piotr Kazmierczak
248b2ba5cd WI: use single auth method for Consul by default (#19169)
This simplifies the default setup of Nomad workloads WI-based
authentication for Consul by using a single auth method with 2 binding rules.

Users can still specify separate auth methods for services and tasks.
2023-11-28 12:22:27 +01:00
Luiz Aoqui
e0cea41e37 client: deprecate loading plugins without config (#19189)
Nomad load all plugins from `plugin_dir` regardless if it is listed in
the agent configuration file. This can cause unexpected binaries to be
executed.

This commit begins the deprecation process of this behaviour. The Nomad
agent will emit a warning log for every plugin binary found without a
corresponding agent configuration block.

---------

Co-authored-by: Michael Schurter <mschurter@hashicorp.com>
2023-11-27 21:36:42 -05:00
Luiz Aoqui
5ff6cce3ab vault: update default JWT auth method path (#19188)
Update default auth method path to be `jwt-nomad` to avoid potential
conflicts when Vault's `jwt` default is already being used for something
else.
2023-11-27 17:48:12 -05:00
Luiz Aoqui
772ddd3638 docs: clarify difference between /client and /node (#19173)
Clarify the difference between the `/client` and `/node` endpoints and
link from one to the other to help users discover the endpoint they are
looking for.

Also update the  `/client` page description and dynamic nod metadata
section headers to help the page be more discoverable by search engines.
2023-11-27 17:47:18 -05:00
Daniel Bennett
eb56fce393 e2e: fix ui tests (#19138) 2023-11-27 12:26:19 -06:00
Piotr Kazmierczak
3b701ee0cf docs: additional note about JWKS endpoints and CA certs (#19144) 2023-11-27 17:34:44 +01:00
dependabot[bot]
73746cc199 chore(deps): bump google.golang.org/grpc from 1.55.0 to 1.59.0 (#18908) 2023-11-27 09:07:17 +00:00
dependabot[bot]
2bbce293ad chore(deps): bump github.com/hashicorp/go-kms-wrapping/v2 (#19175) 2023-11-27 08:41:01 +00:00
Piotr Kazmierczak
742651f2f7 agent: ignore websocket statuses 1000, 1001 and 1005 correctly (#19172)
These are "close" messages and not actual errors.
2023-11-27 09:33:08 +01:00
Phil Renaud
fb14c2b556 [ui] Actions service and flyout (#19084)
* Initial pass at a global actions instance queue

* Action card with a bunch of functionality that needs to be pared back a bit

* Happy little actions button

* runAction performs updated to use actions service

* Stop All and Clear Finished buttons

* Keyboard service now passes element, so we can pseudo-click the actions dropdown

* resizable sidebar code blocks

* Contextual actions within task and job levels

* runAction greatly consolidated

* Pluralize action text

* Peer grouping of flyout action intances

* ShortIDs instead of full alloc IDs

* Testfixes that previously depended on notifications

* Stop and stop all for peered action instances

* Job name in action instance card linkable

* Componentized actions global button

* scss consolidation

* Clear and Stop buttons become mutually exclusive in an action card

* Clean up action card title styles a bit

* todo-bashing

* stopAll and stopPeers separated and fixed up

* Socket handling functions moved to the Actions service

* Error handling on socket message

* Smarter import

* Documentation note: need alloc-exec and alloc-raw-exec for raw_exec jobs

* Tests for flyout and dropdown actions

* Docs link when in empty flyout/queue state and percy snapshot test for it
2023-11-26 23:46:44 -05:00
James Rasell
cfbb2e8923 cli: use spaces when outputting ACL auth method token TTL param. (#19159) 2023-11-24 10:39:27 +00:00
Luiz Aoqui
bdac8d9583 cli: prevent panic on CTRL+C during a question (#19154)
Fix a panic when a question receives an interrupt signal before the
signal handler is initialized.
2023-11-23 14:51:56 -05:00
Luiz Aoqui
d2849b8a76 cli: skip allocs with replacements on job restart (#19155)
The `nomad job restart` command should skip allocations that already
have replacements. Restarting an allocation with a replacement is a
no-op because the allocation status is terminal and the command's
replacement monitor returns immediatelly.

But by not skipping them, the effective batch size is computed
incorrectly.
2023-11-23 14:51:10 -05:00
Jorge Marey
46442f441f Set correct submit time to stopped jobs (#18967) 2023-11-23 10:30:39 -05:00
James Rasell
e8e7e85b03 actions: add RPC tests and set reply index value. (#19151) 2023-11-23 08:10:56 +00:00
James Rasell
532402aa2d actions: use specific RPC request object and tighten naming. (#19149) 2023-11-23 07:42:37 +00:00
Phil Renaud
eb8553c16f Reframe nomad action as a wrapper around nomad job action (#19048)
* Reframe nomad action as a wrapper around nomad job action

* dont conditionally pass flags, just pass flags

* PR comments addressed
2023-11-22 09:23:48 -05:00
James Rasell
0f0b9a1a3c action: add job action name validation (#19145) 2023-11-22 08:02:49 +00:00
Phil Renaud
e03e674135 [ui] UI actions implementation on task index (#19036)
* Sidequest: always show actions column on client view

* Task sidebar and task index actions menus

* Fixing test-fixture selector to no longer use old title class

* Remove actions dropdown from fly-out

* PR feedback addressed
2023-11-22 01:18:11 -05:00
dependabot[bot]
36b74496a5 chore(deps): bump github.com/go-jose/go-jose/v3 from 3.0.0 to 3.0.1 (#19146)
Bumps [github.com/go-jose/go-jose/v3](https://github.com/go-jose/go-jose) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/go-jose/go-jose/releases)
- [Changelog](https://github.com/go-jose/go-jose/blob/v3/CHANGELOG.md)
- [Commits](https://github.com/go-jose/go-jose/compare/v3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: github.com/go-jose/go-jose/v3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-21 20:20:45 -05:00
James Rasell
e3979dd5a1 actions: add test coverage to structs and fix equal func. (#19141) 2023-11-21 15:37:04 +00:00