Loading
Add support for Kubernetes user namespaces (closes #440)
What does this MR do?
This MR adds support for the Kubernetes User Namespaces feature (Kubernetes 1.25+, Beta in 1.30, default in 1.33+) in the GitLab Runner Helm Chart.
- Runner Manager Pod: Exposes
hostUsersat the top level invalues.yamland maps it tospec.hostUsersintemplates/deployment.yaml. - Build / Job Pods: Exposes
runners.hostUsersandrunners.hostUsersOverwriteAllowedinvalues.yamland injectsKUBERNETES_HOST_USERSandKUBERNETES_HOST_USERS_OVERWRITE_ALLOWEDinto the runner container environment intemplates/_env_vars.tpl. - Documentation: Adds comments and configuration examples under
values.yamlandrunners.config. - Unit Tests: Adds unit test coverage in
tests/deployment_test.yamlverifying rendering withhostUsers: true,hostUsers: false, unset, and verifying build pod environment variable injection.
Why was this MR needed?
Kubernetes User Namespaces allows processes running inside containers to map their container root user to an unprivileged UID outside on the host node, protecting the host and cluster from container breakout vulnerabilities.
The gitlab-runner binary already supports host_users and host_users_overwrite_allowed in [runners.kubernetes] (via gitlab-runner!6557). This MR exposes corresponding configuration options in the official Helm Chart so users can easily enable user namespaces for both the runner manager deployment and runner build pods.
What are the relevant issue numbers?
Closes #440
Edited by Manish Kumar