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: {}