Skip to content

Introduce legacy namespace fields for managed resources

What does this MR do and why?

Introduce legacy namespace fields for managed resources

This change set introduces a new legacy namespace field for GitLab-managed resources templates.

Related work has been implemented in KAS with:

Refs gitlab-org/cluster-integration/gitlab-agent#744 (closed)

Validation

  • Setup KAS with an agent and GitLab-managed resources.
  • Run such a pipeline
  • Verify an object in the cluster to verify the annotations that look something like this:
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Namespace
metadata:
  annotations:
    agent.gitlab.com/env-manres2-20-1: '{"environment_id":107,"environment_name":"manres2","environment_slug":"manres2","environment_page_url":"https://gdk.test:3443/root/agentk-test/-/environments/107","environment_tier":"other","agent_id":1,"agent_name":"k3d-agentk","agent_url":"https://gdk.test:3443/root/agentk-test/-/cluster_agents/k3d-agentk","project_id":20,"project_slug":"agentk-test","project_path":"root/agentk-test","project_url":"https://gdk.test:3443/root/agentk-test","template_name":"default","project_rfc1123_slug":"agentk-test","legacy_namespace":"agentk-test-20manres2"}'
  creationTimestamp: "2025-09-25T11:09:02Z"
  labels:
    agent.gitlab.com/env-manres2-20-1: ""
    agent.gitlab.com/environment_slug-manres2: ""
    agent.gitlab.com/id-1: ""
    agent.gitlab.com/project_id-20: ""
    kubernetes.io/metadata.name: manres2-20-1
  name: manres2-20-1
  resourceVersion: "3722661"
  uid: e7b358ec-4a65-4a38-b4b4-5dbe64676345
spec:
  finalizers:
  - kubernetes
status:
  phase: Active

Note the new legacy_namespace1 field in the agent.gitlab.com/env-*** annotation.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Timo Furrer

Merge request reports

Loading