Skip to content

feat: support per-component Deployment labels and annotations#882

Open
somaz94 wants to merge 1 commit into
kedacore:mainfrom
somaz94:feat/per-component-deployment-labels-annotations
Open

feat: support per-component Deployment labels and annotations#882
somaz94 wants to merge 1 commit into
kedacore:mainfrom
somaz94:feat/per-component-deployment-labels-annotations

Conversation

@somaz94

@somaz94 somaz94 commented Jun 22, 2026

Copy link
Copy Markdown

What

Adds top-level deploymentLabels and deploymentAnnotations values, keyed per component (keda / metricsAdapter / webhooks), and wires them into the metadata.labels / metadata.annotations of the operator, metrics-apiserver and webhooks Deployments.

Why

Today the only way to set Deployment-level labels/annotations is additionalLabels / additionalAnnotations, which are shared across every component. There is no way to give a different value per component. The use case in #418 is Datadog unified service tagging, where each Deployment needs a distinct service (operator / metrics-apiserver / webhook).

This mirrors the existing per-component podLabels / podAnnotations interface exactly, so the shape is already familiar:

deploymentAnnotations:
  keda:
    ad.datadoghq.com/tags: '{"service":"operator"}'
  metricsAdapter:
    ad.datadoghq.com/tags: '{"service":"metrics-apiserver"}'
  webhooks:
    ad.datadoghq.com/tags: '{"service":"webhook"}'
deploymentLabels:
  keda:
    team: platform

When set alongside additionalAnnotations, both are merged onto the Deployment.

A note on the approach

In #418 you raised the question of whether to follow the existing podLabels/podAnnotations map style or move toward a {component}.foo.bar nested style. I went with the existing top-level map style here for consistency with podLabels/podAnnotations and to keep the diff small. Happy to refactor to the per-component nested style if that is the direction you prefer.

Validation (local)

  • helm lint keda passes.
  • Default render is byte-identical to main (new keys default to {}, so existing installs see no change).
  • helm template with the values above merges additionalAnnotations + per-component deploymentAnnotations, and appends per-component deploymentLabels, on all three Deployments.
  • Installed on a kind v1.34 cluster: all three Deployments carry the expected per-component metadata.labels / metadata.annotations on the live specs, and all pods reach Running.
  • keda/Chart.yaml version intentionally not bumped, per CONTRIBUTING (chart versions are released with KEDA core).

Resolves #418

Signed-off-by: somaz <genius5711@gmail.com>
@somaz94 somaz94 force-pushed the feat/per-component-deployment-labels-annotations branch from 905e912 to 5850a21 Compare June 23, 2026 09:46
@somaz94 somaz94 marked this pull request as ready for review June 24, 2026 01:28
@somaz94 somaz94 requested review from a team as code owners June 24, 2026 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a way to configure Deployment labels/annotations per component

1 participant