k8s integration environment/cluster scope

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

Problem to solve

We are using multi-cluster setup with Gitlab integrations, not managed ones, but we are using Terraform to add the Clusters to specific projects, so we are using environment scopes to set correct clusters, however, we would love to set different environment scope than the name itself (env name should not dependant on the scope), but there is no possibility to set the "environment scope" in the gitlab-ci.yaml

Intended users

Us and anyone who manages multiple clusters and leveraging the environment scope to identify multiple clusters

Proposal

Optional scope: parameter for the environment: section in the gitlab-ci.yaml file that will override the default scope taken from the name.

gitlab-ci.yaml:

environment:
  name: app-prod
  scope: projectId_clusterOne_namespace_app
...
environment:
  name: app-spot
  scope: projectId_clusterSpotinst_namespace_app
...
environment:
  name: app-china
  scope: projectId_clusterChina_namespace_app

Gitlab cluster integration:

  • Cluster clusterOne environment scope projectId_clusterOne_namespace_*
  • Cluster with spot instances environment scope projectId_clusterSpotinst_namespace_*
  • Cluster in china environment scope projectId_clusterChina_namespace_*

The goal is to have the scope in gitlab-ci.yaml with all info we need to be able to quickly see where the application is running as we do have 20+ GCP projects with at least 2 clusters per each project. The environment name should be short and clean so the Deploy board will not be affected by "ugly" scopes.

## Alternative proposal

What about not using environment name as the scope for k8s integration and introduce something like cluster_scope instead? (So it will not affect current human friendly environment names)

Testing

No risks if the environment scope will have default as a current solution - environment name.

Edited Sep 22, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading