Commit Graph

25020 Commits

Author SHA1 Message Date
James Rasell
776a26bce7 raft: remove use of deprecated Leader func. (#18352)
Co-authored-by: Luiz Aoqui <luiz@hashicorp.com>
2023-09-01 10:01:34 +01:00
Luiz Aoqui
7466496608 config: fix identity config for Consul service (#18363)
Rename the agent configuraion for workload identity to
`WorkloadIdentityConfig` to make its use more explicit and remove the
`ServiceName` field since it is never expected to be defined in a
configuration file.

Also update the job mutation to inject a service identity following
these rules:

1. Don't inject identity if `consul.use_identity` is false.
2. Don't inject identity if `consul.service_identity` is not specified.
3. Don't inject identity if service provider is not `consul`.
4. Set name and service name if the service specifies an identity.
5. Inject `consul.service_identity` if service does not specify an
   identity.
2023-08-31 11:22:48 -03:00
Seth Hoenig
05c3322214 Revert "client: include response body in output for successful HTTP checks (#18345)" (#18362)
* Revert "client: include response body in output for successful HTTP checks (#18345)"

This reverts commit d0a93f12d1.

* cr: add comment about dropping ok output

Co-authored-by: Luiz Aoqui <luiz@hashicorp.com>

---------

Co-authored-by: Luiz Aoqui <luiz@hashicorp.com>
2023-08-30 08:22:28 -05:00
Matthew Salsamendi
d0a93f12d1 client: include response body in output for successful HTTP checks (#18345) 2023-08-28 19:15:06 -04:00
Gerard Nguyen
f187afab9f jobspec: add diff for Task Group Scaling block (#18332) 2023-08-28 18:37:00 -04:00
stswidwinski
f25480c9e9 Ensure that the index processed by the client is at least as new as the last one processed. (#18269)
Ensure that the index processed by the client is at least as new as the last index processed so that stale data does not impact the running allocations.
2023-08-25 15:54:58 -07:00
Luiz Aoqui
da830b1046 nds: add validation for tls_skip_verify (#18333) 2023-08-25 11:55:10 -04:00
James Rasell
96cc610b3c ci: migrate semgrep action from deprecated wrapper (#18324) 2023-08-25 15:24:23 +01:00
James Rasell
a9d5beb141 test: use correct parallel test setup func (#18326) 2023-08-25 13:51:36 +01:00
Piotr Kazmierczak
af2a08cc13 job_endpoint hooks: fix identity block mutator behavior (#18320)
If there's an identity block present in the config, do not overwrite it
completely. Only set the Name and ServiceName fields, and keep the rest.
2023-08-25 11:09:03 +02:00
James Rasell
f7a336d2ba test: use must package for state store restore test file. (#18316) 2023-08-25 09:10:34 +01:00
Luiz Aoqui
c16f268d22 jobspec: add diff for alternate workload identities (#18319) 2023-08-24 18:16:29 -04:00
Piotr Kazmierczak
1c7b34543c job_endpoint: jobIdentityCreator hook (#18317)
This PR introduces a job-mutating hook that inserts an Identity block for
services that use the consul provider.
2023-08-24 19:36:51 +02:00
Piotr Kazmierczak
b430d21a67 agent: add consul.service_identity and consul.template_identity blocks (#18279)
This PR introduces updates to the agent config required for workload identity support.
2023-08-24 17:45:34 +02:00
James Rasell
c43dcb4bf8 ci: ensure semgrep tests all state store funcs for FSM time rule. (#18315) 2023-08-24 15:08:53 +01:00
Seth Hoenig
f5b0da1d55 all: swap exp packages for maps, slices (#18311) 2023-08-23 15:42:13 -05:00
Luiz Aoqui
e69e3c6677 docs: expand on where node_class may be used (#18288) 2023-08-23 15:59:43 -04:00
Kevin Wang
462427455d (website): node 16 (#18302) 2023-08-23 11:41:17 -04:00
Luiz Aoqui
6c43080b55 docs: remove datacenter from job examples (#18289) 2023-08-23 11:37:40 -04:00
Iwan Aucamp
f122d291d2 docs: fix a sentence in vault-integration.mdx (#18296) 2023-08-23 11:24:23 +01:00
Андрей Неустроев
3e61b3a37d Add multiple times in periodic jobs (#17858) 2023-08-22 15:42:31 -04:00
Luiz Aoqui
7548eecbaa docs: clarify reference to network.mode in docker network_mode config (#18277) 2023-08-22 15:07:22 -04:00
Lance Haig
0b9cf4e7b7 Deprecate the Original Bootstrap Token Code (#17792) 2023-08-22 08:06:15 +01:00
Luiz Aoqui
14a38bee7b client: 404 when accessing files for GC'ed alloc (#18232)
When an allocation is garbage collected from the client, but not from
the servers, the API request is routed to the client and the client
does attempt to read the file, but the alloc dir has already been
deleted, resulting in a 500 error.

This happens because the client GC only destroys the alloc runner
(deleting the alloc dir), but it keeps a reference to the alloc runner
until the alloc is garbage collected from the servers as well.

This commit adjusts this logic by checking if the alloc runner (and the
alloc files) has been destroyed, returning a 404 if so.
2023-08-21 16:09:24 -04:00
Piotr Kazmierczak
9fa39eb829 jobspec: add nomad_service field and identity block (#18239)
This PR introduces updates to the jobspec required for workload identity support for services.
---------

Co-authored-by: Luiz Aoqui <luiz@hashicorp.com>
2023-08-21 20:07:47 +02:00
Luiz Aoqui
6b374f6487 changelog: add v1.3.16 (#18259) 2023-08-21 12:29:54 -04:00
János Szathmáry
1e9ccc3ed8 feat: improve policy documentation for "query_window" property (#17929) 2023-08-18 17:43:23 -04:00
Tim Gross
b51b2a2705 fingerprint: add support for fingerprinting multiple Vault clusters (#18253)
Add fingerprinting we'll need to accept multiple Vault clusters in upcoming
Nomad Enterprise features. The fingerprinter will create a map of Vault clients
by cluster name. In Nomad CE, all but the default cluster will be ignored and
there will be no visible behavior change.
2023-08-18 15:33:22 -04:00
Luiz Aoqui
196213c451 jobspec: add role to vault (#18257) 2023-08-18 15:29:02 -04:00
Tim Gross
a8bad048b6 config: parsing support for multiple Consul clusters in agent config (#18255)
Add the plumbing we need to accept multiple Consul clusters in Nomad agent
configuration, to support upcoming Nomad Enterprise features. The `consul` blocks
are differentiated by a new `name` field, and if the `name` is omitted it
becomes the "default" Consul configuration. All blocks with the same name are
merged together, as with the existing behavior.

As with the `vault` block, we're still using HCL1 for parsing configuration and
the `Decode` method doesn't parse multiple blocks differentiated only by a field
name without a label. So we've had to add an extra parsing pass, similar to what
we've done for HCL1 jobspecs. This also revealed a subtle bug in the `vault`
block handling of extra keys when there are multiple `vault` blocks, which I've
fixed here.

For now, all existing consumers will use the "default" Consul configuration, so
there's no user-facing behavior change in this changeset other than the contents
of the agent self API.

Ref: https://github.com/hashicorp/team-nomad/issues/404
2023-08-18 15:25:16 -04:00
Phil Renaud
30a9b6eda7 ui: Use ]] and [[ to paginate index pages (#18210)
* bracket keynav enabled

* Use the right testcluster

* Modifier made to be conditional

* Lintfix

* Custom ignore rule

* changelog
2023-08-18 09:18:15 -04:00
James Rasell
6108f5c4c3 admin: rename _oss files to _ce (#18209) 2023-08-18 07:47:24 +01:00
Tim Gross
74b796e6d0 config: parsing support for multiple Vault clusters in agent config (#18224)
Add the plumbing we need to accept multiple Vault clusters in Nomad agent
configuration, to support upcoming Nomad Enterprise features. The `vault` blocks
are differentiated by a new `name` field, and if the `name` is omitted it
becomes the "default" Vault configuration. All blocks with the same name are
merged together, as with the existing behavior.

Unfortunately we're still using HCL1 for parsing configuration and the `Decode`
method doesn't parse multiple blocks differentiated only by a field name without
a label. So we've had to add an extra parsing pass, similar to what we've done
for HCL1 jobspecs.

For now, all existing consumers will use the "default" Vault configuration, so
there's no user-facing behavior change in this changeset other than the contents
of the agent self API.

Ref: https://github.com/hashicorp/team-nomad/issues/404
2023-08-17 14:10:32 -04:00
Luiz Aoqui
52f0bd4630 ci: update BPA (#18252) 2023-08-17 11:01:38 -04:00
James Rasell
0490bce03e nomad: remove custom max func and use Go 1.21.0 builtin (#18237) 2023-08-17 15:50:29 +01:00
Luiz Aoqui
6c34fbbc8c ci: remove backport automerge (#18247)
Backport assistant has been failing and generating wrong PRs and merges
sometimes. Removing the `-automerge` flag allows us to review and fix
backports before they are silently merged.

Examples of incorrect backporting:

https://github.com/hashicorp/nomad/pull/17925/files
950235df48

https://github.com/hashicorp/nomad/pull/18234/files
52e2ad7807
2023-08-17 10:47:15 -04:00
Phil Renaud
ba7892d0d2 Trim variable path before save (#18198) 2023-08-17 10:46:44 -04:00
James Rasell
d23ee134c5 deps: update hashicorp/go-set to v0.1.14 (#18240) 2023-08-17 15:03:15 +01:00
Luiz Aoqui
bff5ef78ae csi: prevent panic on volume delete (#18234)
When a CSI volume is deleted while its plugin is not running, the
function `volAndPluginLookup` returns a `nil` plugin value resulting in a
panic in the request handler.
2023-08-17 09:47:40 -04:00
Luiz Aoqui
140159511b demo: update image for hostpath CSI plugin (#18236) 2023-08-17 09:36:28 -04:00
Phil Renaud
d1a24309e2 [ui] Preserve HCL2 on stop/start via the web UI (#18120)
* long walk for a ham sandwich

* testfix for service job start

* hold point, breaks identified

* Testfixes for job start/stop helper
2023-08-17 09:32:42 -04:00
Piotr Kazmierczak
53ef6391a5 drivers/docker: fix a hostConfigMemorySwappiness panic (#18238)
cgroupslib.MaybeDisableMemorySwappiness returned an incorrect type, and was
incorrectly typecast to int64 causing a panic on non-linux and non-windows hosts.
2023-08-17 14:45:31 +02:00
Luiz Aoqui
e21ab7d948 docs: fix job dispatch documentation (#18225) 2023-08-16 17:22:55 -04:00
Luiz Aoqui
6d1a2a0f81 docs: move glossary to a top-level menu item (#18223) 2023-08-16 17:22:32 -04:00
Luiz Aoqui
01d71ca70e docs: expand documentation on node pools (#18109) 2023-08-16 11:16:06 -04:00
hashicorp-copywrite[bot]
9af2a9b396 [COMPLIANCE] License update (#18218) 2023-08-16 15:59:33 +01:00
hashicorp-copywrite[bot]
4f55df8306 Adding explicit MPL license for sub-package (#18219)
This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-08-16 09:59:07 -05:00
Seth Hoenig
6fca4fa715 test-e2e: no need to run vaultcomat tests as root (#18215)
6747ef8803 fixes the Nomad client to support using the raw_exec
driver while running as a non-root user. Remove the use of sudo
in the test-e2e workflow for running integration (vaultcompat)
tests.
2023-08-15 16:00:54 -05:00
Seth Hoenig
8833452d44 followup to numa/cgroups refactor (#18214)
* lang: note that Stack is not concurrency-safe

* client: use more descriptive name for wrangler hook in logs

* numalib: use correct name for receiver parameter
2023-08-15 14:12:17 -05:00
Tim Gross
f00bff09f1 fix multiple overflow errors in exponential backoff (#18200)
We use capped exponential backoff in several places in the code when handling
failures. The code we've copy-and-pasted all over has a check to see if the
backoff is greater than the limit, but this check happens after the bitshift and
we always increment the number of attempts. This causes an overflow with a
fairly small number of failures (ex. at one place I tested it occurs after only
24 iterations), resulting in a negative backoff which then never recovers. The
backoff becomes a tight loop consuming resources and/or DoS'ing a Nomad RPC
handler or an external API such as Vault. Note this doesn't occur in places
where we cap the number of iterations so the loop breaks (usually to return an
error), so long as the number of iterations is reasonable.

Introduce a helper with a check on the cap before the bitshift to avoid overflow in all 
places this can occur.

Fixes: #18199
Co-authored-by: stswidwinski <stan.swidwinski@gmail.com>
2023-08-15 14:38:18 -04:00