Commit Graph

53 Commits

Author SHA1 Message Date
hashicorp-copywrite[bot] 005636afa0 [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
Seth Hoenig 590ae08752
main: remove deprecated uses of rand.Seed (#16074)
* main: remove deprecated uses of rand.Seed

go1.20 deprecates rand.Seed, and seeds the rand package
automatically. Remove cases where we seed the random package,
and cleanup the one case where we intentionally create a
known random source.

* cl: update cl

* mod: update go mod
2023-02-07 09:19:38 -06:00
Tim Gross 8a7d6b0cde
cli: remove deprecated `keyring` and `keygen` commands (#16068)
These command were marked as deprecated in 1.4.0 with intent to remove in
1.5.0. Remove them and clean up the docs.
2023-02-07 09:49:52 -05:00
Seth Hoenig 51a2212d3d
client: sandbox go-getter subprocess with landlock (#15328)
* client: sandbox go-getter subprocess with landlock

This PR re-implements the getter package for artifact downloads as a subprocess.

Key changes include

On all platforms, run getter as a child process of the Nomad agent.
On Linux platforms running as root, run the child process as the nobody user.
On supporting Linux kernels, uses landlock for filesystem isolation (via go-landlock).
On all platforms, restrict environment variables of the child process to a static set.
notably TMP/TEMP now points within the allocation's task directory
kernel.landlock attribute is fingerprinted (version number or unavailable)
These changes make Nomad client more resilient against a faulty go-getter implementation that may panic, and more secure against bad actors attempting to use artifact downloads as a privilege escalation vector.

Adds new e2e/artifact suite for ensuring artifact downloading works.

TODO: Windows git test (need to modify the image, etc... followup PR)

* landlock: fixup items from cr

* cr: fixup tests and go.mod file
2022-12-07 16:02:25 -06:00
Tim Gross bcd26f8815
docker_logger: reorder imports to save memory (#14875)
Nomad runs one logmon process and also one docker_logger process for each
running allocation. A naive look at memory usage shows 10-30 MB of RSS, but a
closer look shows that most of this memory (ex. all but ~2MB for logmon) is
shared (`Shared_Clean` in Linux pmap).

But a heap dump of docker_logger shows that it currently has an extra ~2500 KiB
of heap (anonymously-mapped unshared memory) used for init blocks coming from
the agent code (ex. mostly regexes from go-version, structs, and the Consul
SDK). The packages for running logmon, docker_logger, and executor have an init
block that parses `os.Args` to drop into their own logic, which prevents them
from loading all the rest of the agent code and saves on memory, so this was
unexpected.

It looks like we accidentally reordered the imports in main to undo some of the
work originally done in 404d2d4c98f1df930be1ae9852fe6e6ae8c1517e. This changeset
restores the ordering. A follow-up heap dump shows this saves ~2MB of unshared
RSS per docker_logger process.
2022-10-11 13:23:03 -04:00
Seth Hoenig 52aaf86f52 raw_exec: make raw exec driver work with cgroups v2
This PR adds support for the raw_exec driver on systems with only cgroups v2.

The raw exec driver is able to use cgroups to manage processes. This happens
only on Linux, when exec_driver is enabled, and the no_cgroups option is not
set. The driver uses the freezer controller to freeze processes of a task,
issue a sigkill, then unfreeze. Previously the implementation assumed cgroups
v1, and now it also supports cgroups v2.

There is a bit of refactoring in this PR, but the fundamental design remains
the same.

Closes #12351 #12348
2022-04-04 16:11:38 -05:00
Mahmood Ali 4fc6e50782
Raft Debugging Improvements (#11414) 2021-11-04 10:16:12 -04:00
Florian Apolloner 0fa60dae9d
Added support for `-force-color` to the CLI. (#10975) 2021-10-06 10:02:42 -04:00
Mahmood Ali d588f91575 add helper commands for debugging state 2020-08-31 08:45:59 -04:00
Lang Martin 07ea822c6a
nomad debug renamed to nomad operator debug (#8602)
* renamed: command/debug.go -> command/operator_debug.go
* website: rename debug -> operator debug
* website/pages/api-docs/agent: name in api docs
2020-08-11 15:39:44 -04:00
Mahmood Ali 6198badb4a fix comment typo 2019-09-18 09:11:08 -04:00
Nick Ethier 4418ae3699
reduce memory required for logmon, docker_logger and executor p… (#6341)
* reduce memory required for logmon, docker_logger and executor processes

* comment early importing
2019-09-17 23:55:07 -04:00
Danielle Tomlinson 91c300c310 ui: Support colored output on Windows
This commit uses the go-colorable library to enable support for coloured
UI output on Windows. This acts as a compatibility layer that takes
standard unix-y terminal codes and translates them into the requisite
windows calls as required.
2019-02-20 14:01:35 +01:00
Danielle Tomlinson 92ebe06d77 cli: Hide `nomad docker_logger` from help output 2019-01-23 16:27:05 +01:00
Nick Ethier 5dee1141d1 executor v2 (#4656)
* client/executor: refactor client to remove interpolation

* executor: POC libcontainer based executor

* vendor: use hashicorp libcontainer fork

* vendor: add libcontainer/nsenter dep

* executor: updated executor interface to simplify operations

* executor: implement logging pipe

* logmon: new logmon plugin to manage task logs

* driver/executor: use logmon for log management

* executor: fix tests and windows build

* executor: fix logging key names

* executor: fix test failures

* executor: add config field to toggle between using libcontainer and standard executors

* logmon: use discover utility to discover nomad executable

* executor: only call libcontainer-shim on main in linux

* logmon: use seperate path configs for stdout/stderr fifos

* executor: windows fixes

* executor: created reusable pid stats collection utility that can be used in an executor

* executor: update fifo.Open calls

* executor: fix build

* remove executor from docker driver

* executor: Shutdown func to kill and cleanup executor and its children

* executor: move linux specific universal executor funcs to seperate file

* move logmon initialization to a task runner hook

* client: doc fixes and renaming from code review


* taskrunner: use shared config struct for logmon fifo fields

* taskrunner: logmon only needs to be started once per task
2018-10-16 16:53:31 -07:00
Michael Schurter 7199a2b960 cli: differentiate normal output vs info 2018-03-30 11:42:11 -07:00
Alex Dadgar 54eff82359 Autocomplete command aliases
This PR allows aliased commands to be autocompleted but still filters
them from the help output.
2018-03-29 12:55:25 -07:00
Chelsea Holland Komlo ae24ebebdd remove unused function 2018-03-23 09:51:27 -04:00
Alex Dadgar 742382146e color 2018-03-21 20:27:32 -07:00
Alex Dadgar aa85b61fc8 Deprecated commands 2018-03-21 20:27:32 -07:00
Alex Dadgar 6faa136e03 common commands 2018-03-21 20:27:32 -07:00
Alex Dadgar b5bee9e06b use subcommands 2018-03-21 20:27:32 -07:00
Alex Dadgar c0f808205e node eligibility command 2018-03-21 16:51:44 -07:00
Alex Dadgar 010228577e Drain cli, api, http 2018-03-21 16:51:43 -07:00
Alex Dadgar c1cc51dbee sync 2017-10-13 14:36:02 -07:00
Alex Dadgar 4173834231 Enable more linters 2017-09-26 15:26:33 -07:00
Chelsea Holland Komlo c704a054e8 remove unneeded hidden command 2017-09-15 20:23:41 +00:00
Chelsea Holland Komlo 9d3104ca26 filter acl subcommands 2017-09-15 19:37:57 +00:00
Chelsea Holland Komlo aa7cc445be fixups from code review 2017-09-15 18:08:46 +00:00
Alex Dadgar 41b22ba9eb Hide non-user commands from autocomplete output
This PR hides non-user CLI commands from the list of autocomplete
suggestions.
2017-09-08 11:24:21 -07:00
Alex Dadgar 84d06f6abe Sync namespace changes 2017-09-07 17:04:21 -07:00
Alex Dadgar 1a86aecf55 Add version package
This PR adds a version package and consolidates version strings into a
Version struct.
2017-08-16 15:44:21 -07:00
Alex Dadgar 67111d46d6 Fix vet issue 2017-07-26 14:53:08 -07:00
Alex Dadgar e15e9ee976 Custom help output 2017-07-25 15:42:22 -07:00
Alex Dadgar d5278a62e7 Job promote command 2017-07-19 15:39:32 -07:00
Alex Dadgar 810ab68f94 Add command autocompletion.
This PR adds command autocompletion to the CLI.
2017-07-17 15:00:40 -07:00
Alex Dadgar df3d9229fe Allow cli package to handle version.
This PR removes our custom handling of the version flag and updates job
history to use a version flag instead of `-job-version`.
2017-07-17 11:04:07 -07:00
Alex Dadgar 9ee5540d3c job deployments 2017-07-07 12:07:07 -07:00
Alex Dadgar 2aa6c13349 deployment promote 2017-07-07 12:07:07 -07:00
Alex Dadgar 57cbbf87f8 deployment list 2017-07-07 12:07:07 -07:00
Alex Dadgar 7719306ef3 job revert 2017-07-07 12:07:07 -07:00
Alex Dadgar abf34204cc JobVersions returns struct with optional diff 2017-07-07 12:05:57 -07:00
Alex Dadgar 2d4d9b79d8 Operator command/endpoint/documentation 2017-02-09 18:04:46 -08:00
Alex Dadgar 4da380bbbf Vendor memberlist fixes 2017-02-08 16:07:33 -08:00
Sean Chittenden 49deaae2ae
Seed random once in main 2016-06-10 15:48:36 -04:00
Diptanu Choudhury 9c8640087d Filtering out nomad check 2016-05-17 05:39:39 +02:00
Alex Dadgar dab856c956 hide the fs subcommands 2016-03-20 17:05:46 -07:00
Diptanu Choudhury 1e4c42f29d Starting the syslog collector along with a docker container 2016-02-09 18:24:30 -08:00
Diptanu Choudhury 1ba1baa9ac Filtered out the executor command 2016-02-05 10:51:29 -08:00
Alex Dadgar cf4a44352f Allow no interfaces in network fingerprinter 2015-11-18 19:01:39 -08:00