Use the agent name as a namespace name

Proposal

When the agent or agent access token is created, we are showing the installation instructions, which should be performed in the cluster. Currently, the suggested namespace for the agent is always gitlab-agent. We are already using the agent name as a release name. The proposal is to use a different namespace for each agent as well.

Before After
helm repo add gitlab https://charts.gitlab.io
helm repo update
helm upgrade --install ${name} gitlab/gitlab-agent \
    --namespace gitlab-agent \
    --create-namespace \
    --set image.tag=v${version} \
    --set config.token=${token} \
    --set config.kasAddress=${address}`
helm repo add gitlab https://charts.gitlab.io
helm repo update
helm upgrade --install ${name} gitlab/gitlab-agent \
    --namespace gitlab-agent-${name} \
    --create-namespace \
    --set image.tag=v${version} \
    --set config.token=${token} \
    --set config.kasAddress=${address}`

Pros

  • It's easier to find after agent creation

Cons

  • The agent needs to figure out where it lives to upgrade. Every time we change the command we make this process harder
  • Based on the agent name we can end up deploying it to the default namespace - this concern can be solved by adding a prefix gitlab-agent- to the namespace.
Edited by Anna Vovchenko