drivers/exec+java: Add task configuration to restore previous PID/IPC isolation behavior

This PR adds pid_mode and ipc_mode options to the exec and java task
driver config options. By default these will defer to the default_pid_mode
and default_ipc_mode agent plugin options created in #9969. Setting
these values to "host" mode disables isolation for the task. Doing so
is not recommended, but may be necessary to support legacy job configurations.

Closes #9970
This commit is contained in:
Seth Hoenig
2021-02-08 10:36:11 -06:00
parent 6c376fc4a2
commit 836ee9e4a2
16 changed files with 330 additions and 37 deletions

View File

@@ -48,6 +48,20 @@ The `java` driver supports the following configuration in the job spec:
- `jvm_options` - (Optional) A list of JVM options to be passed while invoking
java. These options are passed without being validated in any way by Nomad.
- `pid_mode` - (Optional) Set to `"private"` to enable PID namespace isolation for
this task, or `"host"` to disable isolation. If left unset, the behavior is
determined from the [`default_pid_mode`][default_pid_mode] in plugin configuration.
!> **Warning:** If set to `"host"`, other processes running as the same user will
be able to access sensitive process information like environment variables.
- `ipc_mode` - (Optional) Set to `"private"` to enable IPC namespace isolation for
this task, or `"host"` to disable isolation. If left unset, the behavior is
determined from the [`default_ipc_mode`][default_ipc_mode] in plugin configuration.
!> **Warning:** If set to `"host"`, other processes running as the same user will be
able to make use of IPC features, like sending unexpected POSIX signals.
## Examples
A simple config block to run a Java Jar:
@@ -192,3 +206,6 @@ create.
This list is configurable through the agent client
[configuration file](/docs/configuration/client#chroot_env).
[default_pid_mode]: /docs/drivers/java#default_pid_mode
[default_ipc_mode]: /docs/drivers/java#default_ipc_mode