Skip to content

Use configured namespace when generating Kubeconfig

What does this MR do and why?

If a namespace is specified when authorising a project or group in an agent's configuration file, inject the namespace into the generated KUBECONFIG.

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

  1. Register an agent, using the following configuration:
    ci_access:
      groups:
      - id: path/to/any/project
        default_namespace: staging
  2. Run a CI pipeline in the project you referenced above using the following .gitlab-ci.yml:
    stages:
      - test
    
    example-job:
      stage: test
      script:
        - cat "$KUBECONFIG"
  3. namespace: staging should be included in the context for the agent.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #339465 (closed)

Edited by Tiger Watson

Merge request reports