Skip to content

Customize K8S namespace per environment

Problem to solve

With https://gitlab.com/gitlab-org/gitlab-ce/issues/52494 we will create a namespace per environment, however, namespace naming occurs automatically and users cannot specify custom names for their namespaces.

When user brings GitLab into the picture into an existing Kubernetes shop, there will be existing namespaces where user may want to deploy to. Currently, it is not possible to define the environment-to-existing-namespace-mapping

Intended users

Operators, developers

Further details

Proposal

Mechanism to allow users to specify custom namespace per environment (perhaps as part of CI configuration).

User is able to provide a namespace for each environment on the "environments" page. This would be possible only for non-managed cluster so GitLab would not create roles or roles bindings.

The option would only be available for project maintainers and owners.

image

Permissions and Security

This feature should only be available to "non-managed cluster" as otherwise people will be able to get access to namespaces for other projects in the group or instance cluster that they should not be allowed to. We will need to be careful about any possible vulnerabilities that escalate privileges to different namespaces.

Documentation

What does success look like, and how can we measure that?

Links / references

Edited by Daniel Gruesso