From 677634d67c3a763918acd609c2c6f577a235a889 Mon Sep 17 00:00:00 2001 From: Anthony Hausman Date: Mon, 6 Jul 2026 09:30:29 +0200 Subject: [PATCH] feat(helm/kmcp): support deployment annotations Add global annotations and controller.annotations keys, mirroring the sibling kagent chart (PR #2143). The Deployment metadata.annotations block uses mergeOverwrite so controller-specific annotations override global ones on key collisions. kmcp has a single Deployment (controller-manager), so no ui.annotations equivalent is needed. Tests cover global-only and override-on-collision cases. helm lint clean, unittest 50/50 pass. Assisted-by: GLM 5.2 Signed-off-by: Anthony Hausman --- helm/kmcp/README.md | 9 +++++++ helm/kmcp/templates/deployment.yaml | 5 ++++ helm/kmcp/tests/deployment_test.yaml | 37 ++++++++++++++++++++++++++++ helm/kmcp/values.yaml | 6 +++++ 4 files changed, 57 insertions(+) diff --git a/helm/kmcp/README.md b/helm/kmcp/README.md index d2cb7bd..a987f63 100644 --- a/helm/kmcp/README.md +++ b/helm/kmcp/README.md @@ -84,6 +84,15 @@ The following table lists the configurable parameters of the KMCP chart and thei | `securityContext.allowPrivilegeEscalation` | Allow privilege escalation | `false` | | `securityContext.capabilities.drop` | Capabilities to drop | `["ALL"]` | +### Annotations Configuration + +| Parameter | Description | Default | +|-----------|-------------|---------| +| `annotations` | Additional annotations applied to the Deployment `metadata.annotations` | `{}` | +| `controller.annotations` | Controller-specific annotations that override `annotations` on key collision | `{}` | +| `podAnnotations` | Annotations applied to the controller Pod template (`spec.template.metadata.annotations`) | `{}` | +| `serviceAccount.annotations` | Annotations applied to the ServiceAccount resource | `{}` | + ### Service Configuration | Parameter | Description | Default | diff --git a/helm/kmcp/templates/deployment.yaml b/helm/kmcp/templates/deployment.yaml index bb044fc..b38edee 100644 --- a/helm/kmcp/templates/deployment.yaml +++ b/helm/kmcp/templates/deployment.yaml @@ -3,6 +3,11 @@ kind: Deployment metadata: name: {{ include "kmcp.fullname" . }}-controller-manager namespace: {{ include "kmcp.namespace" . }} + {{- $annotations := mergeOverwrite (dict) (default dict .Values.annotations) (default dict .Values.controller.annotations) }} + {{- if $annotations }} + annotations: + {{- toYaml $annotations | nindent 4 }} + {{- end }} labels: {{- include "kmcp.labels" . | nindent 4 }} spec: diff --git a/helm/kmcp/tests/deployment_test.yaml b/helm/kmcp/tests/deployment_test.yaml index d17d730..5cf21dd 100644 --- a/helm/kmcp/tests/deployment_test.yaml +++ b/helm/kmcp/tests/deployment_test.yaml @@ -77,6 +77,43 @@ tests: count: 1 - matchSnapshot: {} + - it: should set global annotations on deployment + template: deployment.yaml + set: + annotations: + app.kubernetes.io/managed-by: "custom" + image.repository: test-repo + image.tag: v1.0.0 + asserts: + - hasDocuments: + count: 1 + - isSubset: + path: metadata.annotations + content: + app.kubernetes.io/managed-by: "custom" + + - it: should set controller annotations on deployment and override global ones + template: deployment.yaml + set: + annotations: + global-key: "global-value" + shared-key: "global-wins" + controller: + annotations: + controller-key: "controller-value" + shared-key: "controller-wins" + image.repository: test-repo + image.tag: v1.0.0 + asserts: + - hasDocuments: + count: 1 + - isSubset: + path: metadata.annotations + content: + global-key: "global-value" + controller-key: "controller-value" + shared-key: "controller-wins" + - it: should include image pull secrets when specified template: deployment.yaml set: diff --git a/helm/kmcp/values.yaml b/helm/kmcp/values.yaml index efd8b7d..965be60 100644 --- a/helm/kmcp/values.yaml +++ b/helm/kmcp/values.yaml @@ -47,6 +47,12 @@ controller: env: [] + # -- Additional annotations to add to the controller Deployment metadata + annotations: {} + +# -- Additional annotations to add to all Kubernetes deployment resources +annotations: {} + # Pod annotations podAnnotations: {}