mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2026-01-05 19:51:29 +00:00
Support rootless plugin containers (#24236)
* Pulls in github.com/go-secure-stdlib/plugincontainer@v0.3.0 which exposes a new `Config.Rootless` option to opt in to extra container configuration options that allow establishing communication with a non-root plugin within a rootless container runtime. * Adds a new "rootless" option for plugin runtimes, so Vault needs to be explicitly told whether the container runtime on the machine is rootless or not. It defaults to false as rootless installs are not the default. * Updates `run_config.go` to use the new option when the plugin runtime is rootless. * Adds new `-rootless` flag to `vault plugin runtime register`, and `rootless` API option to the register API. * Adds rootless Docker installation to CI to support tests for the new functionality. * Minor test refactor to minimise the number of test Vault cores that need to be made for the external plugin container tests. * Documentation for the new rootless configuration and the new (reduced) set of restrictions for plugin containers. * As well as adding rootless support, we've decided to drop explicit support for podman for now, but there's no barrier other than support burden to adding it back again in future so it will depend on demand.
This commit is contained in:
32
.github/workflows/test-go.yml
vendored
32
.github/workflows/test-go.yml
vendored
@@ -286,14 +286,37 @@ jobs:
|
||||
"runsc": {
|
||||
"path": "/usr/local/bin/runsc",
|
||||
"runtimeArgs": [
|
||||
"--host-uds=all",
|
||||
"--host-fifo=open"
|
||||
"--host-uds=create"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
sudo systemctl reload docker
|
||||
- name: Install rootless Docker
|
||||
# Enterprise repo runners do not allow sudo, so can't system packages there yet.
|
||||
if: ${{ !inputs.enterprise }}
|
||||
run: |
|
||||
sudo apt-get install -y uidmap dbus-user-session
|
||||
export FORCE_ROOTLESS_INSTALL=1
|
||||
curl -fsSL https://get.docker.com/rootless | sh
|
||||
mkdir -p ~/.config/docker/
|
||||
tee ~/.config/docker/daemon.json <<EOF
|
||||
{
|
||||
"runtimes": {
|
||||
"runsc": {
|
||||
"path": "/usr/local/bin/runsc",
|
||||
"runtimeArgs": [
|
||||
"--host-uds=create",
|
||||
"--ignore-cgroups"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
systemctl --user restart docker
|
||||
# Ensure the original rootful Docker install is still the default.
|
||||
docker context use default
|
||||
- id: run-go-tests
|
||||
name: Run Go tests
|
||||
timeout-minutes: ${{ fromJSON(env.TIMEOUT_IN_MINUTES) }}
|
||||
@@ -356,8 +379,9 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
|
||||
export VAULT_TEST_LOG_DIR=$(pwd)/test-results/go-test/logs-${{ matrix.id }}
|
||||
mkdir -p $VAULT_TEST_LOG_DIR
|
||||
VAULT_TEST_LOG_DIR="$(pwd)/test-results/go-test/logs-${{ matrix.id }}"
|
||||
export VAULT_TEST_LOG_DIR
|
||||
mkdir -p "$VAULT_TEST_LOG_DIR"
|
||||
|
||||
|
||||
# shellcheck disable=SC2086 # can't quote RERUN_FAILS
|
||||
|
||||
Reference in New Issue
Block a user