Configurable Deployment labels in Kubernetes integration
Problem to solve
Setting-up Kubernetes integration with existing cluster results in ugly/complex environment names, because GitLab requires an app
label. While this label is generally present, it is often not suitable for an environment name.
Further details
Example use case: we are deploying with Helm and the app
labels are quite long as they include release name, stage and chart name. I would rather use a different label, such as gitlab-filter
.
Proposal
- While keeping the
app
label as default selector, allow configuring customDeployment
filters (and alsoPod
filters, unless they are simplified as suggested in #6389 (closed)) - Very generic filters could be implemented with the kubectl
--selector
syntax [1]- such a filter could default to
CI_ENVIRONMENT_POD_FILTER=app=$CI_ENVIRONMENT_SLUG
- more complex example:
CI_ENVIRONMENT_POD_FILTER=gitlab-filter=$CI_ENVIRONMENT_SLUG,stage=beta
- such a filter could default to
What does success look like, and how can we measure that?
GitLab integration no longer requires an app
label, but can be configured with different pod filter.
Links / references
[1]
Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)