Commit Graph

26402 Commits

Author SHA1 Message Date
Piotr Kazmierczak
f7a4ded2c0 security: add CT executeTemplate to default function_denylist (#24541)
This PR adds Consul Template's executeTemplate function to the denylist by
default, in order to prevent accidental or malicious infinitely recursive
execution.

---------

Co-authored-by: Tim Gross <tgross@hashicorp.com>
2024-11-22 19:33:56 +01:00
Piotr Kazmierczak
368241dbf2 security: a more comprehensive env.denylist (#24540)
A more comprehensive env.denylist that now includes more token, token file and
license variables. 

---------

Co-authored-by: Daniel Bennett <dbennett@hashicorp.com>
2024-11-22 18:54:18 +01:00
Yucong Sun
642e33ae41 CSI: fix topology matching logic (#24522)
Some plugins emit multiple topology segment entries for the same segment (ex. newer versions of AWS EBS) to accommodate convention changes in k8s. Check that segments are a superset instead of exactly equal to the plugin's topology segments.
2024-11-22 09:22:36 -05:00
Juana De La Cuesta
c21dfdb17a [gh-476] Sanitise HCL variables before storing on job submission (#24423)
* func: User url rules to scape non alphanumeric values in hcl variables

* docs: add changelog

* func: unscape flags before returning

* use JSON.stringify instead of bespoke value quoting to handle in-value-multi-line cases

---------

Co-authored-by: Phil Renaud <phil@riotindustries.com>
2024-11-22 11:45:02 +01:00
Martijn Vegter
997da25cdb scheduler: take all assigned cpu cores into account instead of only those part of the largest lifecycle (#24304)
Fixes a bug in the AllocatedResources.Comparable method, where the scheduler
would only take into account the cpusets of the tasks in the largest lifecycle.
This could result in overlapping cgroup cpusets. Now we make the distinction
between reserved and fungible resources throughout the lifespan of the alloc.
In addition, added logging in case of future regressions thus not requiring
manual inspection of cgroup files.
2024-11-21 13:21:48 -05:00
Juana De La Cuesta
a9e7166b6b [gh-24339] Move from streaming stats to polling for docker (#24525)
* fix: dont stream the docker stats, read them one by one

* func: add a NewSafeTicker to the herlper functions

* style: remove commented code
2024-11-21 17:36:53 +01:00
Martijn Vegter
bfb714144e client: fixed a bug where AMD CPUs were not correctly fingerprinting base speed (#24415)
Relates to: #19468
2024-11-21 09:08:47 -06:00
Piotr Kazmierczak
6ccfcc37a3 scheduler: fix a bug where force GC wasn't respected (#24456)
This PR fixes a bug where System.GarbageCollect endpoint didn't work on objects
that weren't older than their respective GC thresholds. System.GarbageCollect
is used to force garbage collection (also used by the system gc command) and
should ignore any GC threshold settings.
2024-11-21 09:07:23 +01:00
Matt McQuillan
a6fbd5a2e2 add default for codeowners file (#24517) 2024-11-20 13:23:47 -08:00
Seth Hoenig
dd396a3900 windows: revert process listing logic to that of v1.6.10 (#24494)
* windows: revert process listing logic to that of v1.6.10

In Nomad 1.7 much of the process management code was refactored, including
a rewrite of how the process tree of an executor was determined on Windows
machines. Unfortunately that rewrite has been cursed with performance issues
and bugs. Instead, revert to the logic used in v1.6.10.

* changelog
2024-11-20 11:20:20 -06:00
Tim Gross
6b9dbefb9e consul: handle nil multierror pointer correctly (#24513)
When the service client syncs to Consul, we accumulate service sync errors in a
multierror before reading all the local checks. If the API call to the local
checks fails, we either return that error or append it to the multierror and
return the set of errors. But `multierror.Error.Len()` doesn't nil-check, so we
need to do this ourselves.

I've also made a quick pass through the rest of the code base looking for
multierror `Len` method calls to see if we have this pattern elsewhere.

Fixes: https://github.com/hashicorp/nomad/issues/24512
2024-11-20 10:55:52 -05:00
James Rasell
beb4097e81 client: mark the remote_task hook as deprecated. (#24505) 2024-11-20 15:32:50 +00:00
Juana De La Cuesta
25cc492a16 docs: update the job subcommands on the docs (#24506) 2024-11-20 08:37:43 -06:00
Phil Renaud
83b30128a0 Add an image of the rendered UI block for a jobspec (#24481) 2024-11-20 09:33:47 -05:00
Phil Renaud
0023edd3ec Updates Playwright in response to an E2E nightly failure (#24487) 2024-11-20 09:33:27 -05:00
Piotr Kazmierczak
9c5078f151 agent: set content type header explicitly (#24489)
This PR addresses an XSS vulnerability where Nomad agents wouldn't explicitly
set content type headers for error responses.
2024-11-20 10:18:30 +01:00
James Rasell
11bba3dbcd docs: fix broken link within enterprise Sentinel docs. (#24486) 2024-11-20 07:43:30 +00:00
Florian Apolloner
0a343798b6 Add NOMAD_* variables to CNI args. Fixes #23830 (#24319)
Co-authored-by: Daniel Bennett <dbennett@hashicorp.com>
2024-11-19 12:48:48 -08:00
Aimee Ukasick
4dfedf1aef add top-level heading so the page renders correctly (#24491)
Add opening paragraph; update description
2024-11-19 11:10:10 -06:00
Phil Renaud
4708e06199 [ui] Fixes double-namespace-query-param when getting versions (#24466) 2024-11-19 10:53:37 -05:00
Tim Gross
a420732424 consul: allow non-root Nomad to rewrite token (#24410)
When a task restarts, the Nomad client may need to rewrite the Consul token, but
it's created with permissions that prevent a non-root agent from writing to
it. While Nomad clients should be run as root (currently), it's harmless to
allow whatever user the Nomad agent is running as to be able to write to it, and
that's one less barrier to rootless Nomad.

Ref: https://github.com/hashicorp/nomad/issues/23859#issuecomment-2465757392
2024-11-19 10:21:14 -05:00
James Rasell
dc501339da docs: Add federated region concept and operations pages. (#24477)
In order to help users understand multi-region federated
deployments, this change adds two new sections to the website.

The first expands the architecture page, so we can add further
detail over time with an initial federation page. The second adds
a federation operations page which goes into failure planning and
mitigation.

Co-authored-by: Aimee Ukasick <aimee.ukasick@hashicorp.com>
Co-authored-by: Michael Schurter <mschurter@hashicorp.com>
2024-11-19 12:39:57 +00:00
Gabi
89c3d69d79 nsutil: wrap error that comes from the syscall so caller can do errors.As (#24480)
User of `nsutil` library should be able to do the following and for it
to work:

```
  var errno syscall.Errno
   if errors.As(err, &errno) {
       if errno == unix.EBUSY { ... }
   }
```

This commit fixes that issue.
2024-11-19 10:24:49 +01:00
Tim Gross
6be9a50626 vault: catch expired lease as fatal error (#24409)
When a Vault lease expires, it's revoked on the server and cannot be removed, so
this error should be treated as fatal.

The errors we get aren't wrapped by the Vault SDK, so unfortunately we have to
read the error messages and can't easily enumerate non-fatal error
messages (which might be bubbling up from the stdlib). I've audited the errors
currently used and have documented their source.

Ref 52ba156d47/vault/expiration.go (L1327)
Fixes: https://github.com/hashicorp/nomad/issues/23859
2024-11-18 09:12:35 -05:00
Juana De La Cuesta
270b4f97a6 Update some details of the terraform readme file for e2e provisioning (#24451)
* docs: update instructions to provision e2e cluster

* Update e2e/terraform/README.md

Co-authored-by: Piotr Kazmierczak <470696+pkazmierczak@users.noreply.github.com>

* Update e2e/terraform/terraform.tfvars

Co-authored-by: Piotr Kazmierczak <470696+pkazmierczak@users.noreply.github.com>

* Update e2e/terraform/README.md

Co-authored-by: Piotr Kazmierczak <470696+pkazmierczak@users.noreply.github.com>

---------

Co-authored-by: Piotr Kazmierczak <470696+pkazmierczak@users.noreply.github.com>
2024-11-18 13:36:51 +01:00
Juana De La Cuesta
1f944196d9 Allow scaling system jobs to 0 (#24363)
* func: remove validation scaling for system jobs and dont canonicalize to 1

* test: update test to validate for 0 and improve error message

* func: remove the canonicalization to 1 from system jobs

* docs: add changelog

* func: add test for scaling system jobs

* temp: add logging to debug test

* fix: clean up after test is done

* fix: scaled down jobs will still have the stop allocation, update test to account for it

* Update the e2e test to accomodate for system jobs to have an alloc per node

* fix: filter to only count ready nodes on the node count

* fix: remove the datacenter constrain from the system job definition

* fix: compare alloc IDs to avoid flaky tests when verifying no alloc was stoped

* fix: remove duplicated code
2024-11-18 13:35:47 +01:00
dependabot[bot]
3dfbc890b2 chore(deps): bump github.com/creack/pty from 1.1.23 to 1.1.24 (#24470)
Bumps [github.com/creack/pty](https://github.com/creack/pty) from 1.1.23 to 1.1.24.
- [Release notes](https://github.com/creack/pty/releases)
- [Commits](https://github.com/creack/pty/compare/v1.1.23...v1.1.24)

---
updated-dependencies:
- dependency-name: github.com/creack/pty
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 09:44:14 +01:00
dependabot[bot]
655fc7534c chore(deps): bump github.com/hashicorp/go-set/v3 (#24469)
Bumps [github.com/hashicorp/go-set/v3](https://github.com/hashicorp/go-set) from 3.0.0-alpha.1 to 3.0.0.
- [Release notes](https://github.com/hashicorp/go-set/releases)
- [Commits](https://github.com/hashicorp/go-set/compare/v3.0.0-alpha.1...v3.0.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-set/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 09:43:29 +01:00
dependabot[bot]
ed2b1d9646 chore(deps): bump google.golang.org/grpc from 1.59.0 to 1.68.0 (#24468)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.59.0 to 1.68.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.59.0...v1.68.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 09:42:01 +01:00
Seth Hoenig
13657e02da deps: update go-landlock v1.2.2 (#24458)
Includes transitive library updates
2024-11-13 14:31:55 -06:00
Piotr Kazmierczak
5dfb38d806 drivers: fix capabilities on non-linux systems (#24450)
Recently we moved from github.com/syndtr/gocapability to
github.com/moby/sys/capability due to the former package no longer being
maintainer. The new package's capability function works differently: the
known/supported functionality is split now, and the .ListSupported() call will
always return an empty list on non-linux systems. This means Nomad agents won't
start on darwin or windows.
2024-11-13 15:58:25 +01:00
Tim Gross
ff8ca8a4c5 tools: filter Nomad Enterprise tags in pre-push hook (#24452)
Our git pre-push hook already prevents Nomad Enterprise code from getting pushed
anywhere but its own repo. But this hook only works for files on the current
worktree (checkout). Were you to fetch an Enterprise tag into your local
Community Edition repo but not have it checked out, and then `git push --tags`,
you'd push that tag and the associated commit history.

Add tag filtering to the pre-push hook to prevent Enterprise tags (and the older
`+pro` SKU) tags from getting pushed to the Community Edition repo.
2024-11-13 09:50:43 -05:00
Bob Conan
cf45f1836f Update CHANGELOG.md, fix typo(s) (#24449)
* Updated CHANGELOG.md, fix typo(s)

* Update CHANGELOG.md, fix typos
2024-11-12 20:26:20 -05:00
Michael Schurter
8dd570d6ca docs: upgrade docs should point at real version (#24438)
Let users know what happened to 1.9.2 but label the gc change as the
first working release (1.9.3).
2024-11-12 11:05:27 -08:00
Seth Hoenig
b36c77781f build: update to go1.23.3 (#24419)
https://github.com/golang/go/issues?q=milestone%3AGo1.23.3+label%3ACherryPickApproved
2024-11-12 10:59:02 -06:00
James Rasell
4e7496d246 keyring: Fix a panic when decrypting aead with empty RSA block. (#24442)
Clusters that have gone through several upgrades have be found
to include keyring material which has an empty RSA block.

In more recent versions of Nomad, an empty RSA block is omitted
from being written to disk. This results in the panic not being
present. Older versions, however, did not have this struct tag
meaning we wrote an empty JSON block which is not accounted for
in the current version.
2024-11-12 14:26:35 +00:00
Piotr Kazmierczak
7a9e3d2487 fsm: handle EventSinkSnapshot type correctly (#24418)
We never handled EventSinkSnapshot correctly. We should error on this snapshot
type, since it should never be encountered in prod Nomad clusters.
2024-11-12 10:42:19 +01:00
Eduardo Medeiros
f8c85b036b docs: remove duplicated word. (#24433)
remove duplicated word “Using using”
2024-11-11 16:10:10 -05:00
Tim Gross
189d648f95 csi: remove redundant namespace field from volume status output (#24432)
The `volume status :id` command outputs the namespace for a CSI volume
twice. Drop the second output.

Ref: https://github.com/hashicorp/nomad/pull/24382#discussion_r1837097250
2024-11-11 16:05:59 -05:00
Shantanu Gadgil
1d123fdc7b docs/tools: add Nomad Tools (#24416)
Add Nomad Tools

`https://github.com/Kamilcuk/nomad-tools`
2024-11-11 14:22:46 -05:00
dependabot[bot]
af379f7020 chore(deps): bump github.com/docker/cli (#24414)
Bumps [github.com/docker/cli](https://github.com/docker/cli) from 24.0.6+incompatible to 27.3.1+incompatible.
- [Commits](https://github.com/docker/cli/compare/v24.0.6...v27.3.1)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-11 14:21:09 -05:00
dependabot[bot]
cfe17e6e8b chore(deps): bump github.com/prometheus/common from 0.45.0 to 0.60.1 (#24303)
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.45.0 to 0.60.1.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.45.0...v0.60.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-11 14:17:25 -05:00
dependabot[bot]
c688322a3f chore(deps): bump github.com/aws/aws-sdk-go from 1.44.210 to 1.55.5 (#24135)
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.44.210 to 1.55.5.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.44.210...v1.55.5)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-11 14:15:23 -05:00
dependabot[bot]
a8676c6e67 chore(deps): bump github.com/hashicorp/consul/api from 1.29.1 to 1.30.0 (#24262)
Bumps [github.com/hashicorp/consul/api](https://github.com/hashicorp/consul) from 1.29.1 to 1.30.0.
- [Release notes](https://github.com/hashicorp/consul/releases)
- [Changelog](https://github.com/hashicorp/consul/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/consul/compare/api/v1.29.1...api/v1.30.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/consul/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-11 14:10:16 -05:00
Kir Kolyshkin
d09c8ddf21 deps: switch to moby/sys/capability (#24093)
github.com/moby/sys/capability is a fork of the (no longer maintained)
github.com/syndtr/gocapability package.

For changes since the fork took place, see
https://github.com/moby/sys/blob/main/capability/CHANGELOG.md

Note that the "workaround for RHEL6" is removed for a number of reasons.
Feel free to choose the one you like the most, either is sufficient:

1. /proc/sys/kernel/cap_last_cap is available since RHEL 6.7
   (kernel 2.6.32-573.el6), released 9 years ago (2015-07-22).

2. It incorrectly returns CAP_BLOCK_SUSPEND (36), which was only added
   in kernel v3.5 and was never backported to RHEL6 kernels. The
   correct value for RHEL6 would be CAP_MAC_ADMIN (33).

3. As far as upstream kernels go, /proc/sys/kernel/cap_last_cap was
   added in kernel v3.2, and a correct value depends on the kernel
   version. It could be CAP_WAKE_ALARM (35), added to kernel v3.0, or
   CAP_SYSLOG (34), added to kernel v2.6.38, or possibly a lesser value
   for even older kernels.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-11-11 14:07:31 -05:00
Piotr Kazmierczak
1f9e97b198 Merge pull request #24424 from hashicorp/post-1.9.3-release
Post 1.9.3 release
2024-11-11 19:45:39 +01:00
hc-github-team-nomad-core
ff699c5e06 Prepare for next release 2024-11-11 19:40:45 +01:00
hc-github-team-nomad-core
9f9e66fa61 Generate files for 1.9.3 release 2024-11-11 19:40:44 +01:00
Piotr Kazmierczak
9e8b3e5c04 changelog for 24412 (#24421) 2024-11-11 17:28:06 +01:00
Tim Gross
645923274d fsm: fix bug in snapshot restore for removed timetable (#24412)
When we removed the time table in #24112 we introduced a bug where if a previous
version of Nomad had written a time table entry, we'd return from the restore
loop early and never load the rest of the FSM. This will result in a mostly or
partially wiped state for that Nomad node, which would then be out of sync with
its peers (which would also have the same problem on upgrade).

The bug only occurs when the FSM is being restored from snapshot, which isn't
the case if you test with a server that's only written Raft logs and not
snapshotted them.

While fixing this bug, we still need to ensure we're reading the time table
entries even if we're throwing them away, so that we move the snapshot reader
along to the next full entry.

Fixes: https://github.com/hashicorp/nomad/issues/24411
2024-11-11 08:01:18 -05:00