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.

  1. Runner Manager Pod: Exposes hostUsers at the top level in values.yaml and maps it to spec.hostUsers in templates/deployment.yaml.
  2. Build / Job Pods: Exposes runners.hostUsers and runners.hostUsersOverwriteAllowed in values.yaml and injects KUBERNETES_HOST_USERS and KUBERNETES_HOST_USERS_OVERWRITE_ALLOWED into the runner container environment in templates/_env_vars.tpl.
  3. Documentation: Adds comments and configuration examples under values.yaml and runners.config.
  4. Unit Tests: Adds unit test coverage in tests/deployment_test.yaml verifying rendering with hostUsers: 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

Merge request reports

Loading
Loading