Kubernetes clusters: Support filtering on custom labels
Description
Currently, it seems that the Environments view (Deploy Boards) assumes a one-to-one mapping between GitLab projects and Kubernetes namespaces. This stems from the fact that the support relies solely on the app=$CI_ENVIRONMENT_SLUG
label being applied to the deployment and the pods.
We have a use case where we have one Kubernetes namespace per environment, e.g. dev
and production
. All our apps go into these namespaces. Thus, if we configure two projects (apps) to use the same Kubernetes cluster with the same environment scope and namespace, we see pods from both projects show up on both Deploy Boards.
Proposal
It would be good to allow more flexibility here, e.g. to support the above use case. I think that providing an option to filter Kubernetes resources by a user-provided label (e.g. name=$CI_PROJECT_NAME
) in the cluster configuration page would be a good starting point.
Alternatively, we could think about using metadata.name
for similar purposes, but that might be more restrictive and assumes that everyone maps that field to the GitLab project name.