Skip to content

Restore namespace separation capability for GitLab Runner

What does this MR do?

This MR restores namespace separation functionality for GitLab Runner that was removed in 2023, resolving issue #413 (closed). Organizations can now deploy runner management resources in one namespace while executing jobs in another.

Commit 0200bbd4 (April 2023) removed all namespace flexibility from GitLab Runner charts, forcing everything into the Release namespace. This broke deployments that relied on namespace separation.

What Happened

  • v0.42.0 (April 2022): MR #343 (closed) added .Values.runners.namespace support
  • April 2023: Commit 0200bbd4 removed all namespace flexibility (the regression)
  • May 2023: Commit f8b3f829 removed remaining references
  • Now: This MR restores the capability with better design

Solution

New Configuration

namespace: "ops"              # Where runner deploys
runners:
  jobNamespace: "gitlab"      # Where jobs execute

Implementation

  • Added .Values.namespace for runner deployment location
  • Added .Values.runners.jobNamespace for job execution namespace
  • Updated all templates (deployment, configmap, secrets, RBAC, services, etc.)
  • Maintains full backward compatibility

Testing

  • Added comprehensive test suite with 13 scenarios
  • Covers namespace separation, RBAC dependencies, edge cases
  • All 44 tests pass (existing + new)
  • Includes regression test for issue #400 (closed) ServiceAccount problems

Example

namespace: "runner-ops"
runners:
  jobNamespace: "ci-workloads"

Migration

Existing deployments: No changes needed

New namespace separation:

helm install my-runner gitlab/gitlab-runner \
  --set namespace=ops \
  --set runners.jobNamespace=gitlab

Validation

All tests pass. Manual testing confirms:

  • Runner resources deploy to specified namespace
  • Jobs execute in separate namespace when configured
  • RBAC and ServiceAccount dependencies resolve correctly
  • Default behavior unchanged

What are the relevant issue numbers?

Closes Regression since 0.42.1 - The job runners are f... (#413 - closed) • Georgi N. Georgiev | GitLab • 18.2

Closes Regression since 0.42.1 - `runners.namespace` c... (#400 - closed) • Georgi N. Georgiev | GitLab • 18.2

Edited by Georgi N. Georgiev | GitLab

Merge request reports

Loading