Conversation
905e912 to
5850a21
Compare
|
@somaz94 Can chart templating support added to the values? with |
|
Done in 024f997 — thanks for the suggestion! I switched the six I scoped the change to the new per-component fields only and left the existing
|
Signed-off-by: somaz <genius5711@gmail.com>
…te support Signed-off-by: somaz <genius5711@gmail.com>
024f997 to
b0daa8b
Compare
|
The single red leg ( The webhook Service wasn't accepting connections yet when the |
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| {{- with .Values.deploymentAnnotations.keda }} | ||
| {{- tpl (toYaml .) $ | nindent 4 }} |
There was a problem hiding this comment.
Using the tpl function for annotations and labels allows end-users to pass dynamic template strings into metadata fields via the values.yaml file. Without tpl, Helm treats configuration values in values.yaml as literal text, causing templates like {{ .Release.Name }} to break or render as raw strings when used inside metadata.
In a nutshell is allows dynamic values.
There was a problem hiding this comment.
To add the concrete numbers to what @mindw said — he's the one who asked for tpl here originally (review of 2026-07-16), and it shipped in b0daa8b.
Rendered against this branch, --set 'deploymentLabels.keda.team=squad-{{ .Release.Name }}':
# with tpl (this branch)
team: squad-keda
# without tpl (plain toYaml)
team: squad-{{ .Release.Name }}For annotations the difference is a literal string instead of the intended value. For labels it's worse than cosmetic: squad-{{ .Release.Name }} isn't a valid label value — braces, spaces and the leading . are all outside [A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])? — so the API server rejects the manifest outright. tpl is what makes the values usable at all here, rather than just nicer.
Cost is limited to these six renders (deploymentLabels / deploymentAnnotations × operator, metrics-adapter, webhooks); nothing else in the chart changed behaviour. Happy to drop it back to toYaml if you'd rather not have templating in these fields — it's a three-line revert — but that would take the feature back to what @mindw asked to change.
There was a problem hiding this comment.
Pull request overview
Adds chart values to configure Deployment-level labels/annotations per KEDA component (operator / metrics adapter / webhooks) and applies them to the corresponding Deployment metadata.labels / metadata.annotations, matching the existing per-component pod metadata pattern.
Changes:
- Introduces
deploymentAnnotationsanddeploymentLabelsinvalues.yaml, keyed by component (keda,metricsAdapter,webhooks). - Wires those per-component values into the three Deployment templates’
metadata.annotationsandmetadata.labels. - Documents the new values in
keda/README.md.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| keda/values.yaml | Adds new per-component deploymentAnnotations / deploymentLabels values. |
| keda/templates/manager/deployment.yaml | Applies per-component Deployment annotations/labels to the operator Deployment. |
| keda/templates/metrics-server/deployment.yaml | Applies per-component Deployment annotations/labels to the metrics-apiserver Deployment. |
| keda/templates/webhooks/deployment.yaml | Applies per-component Deployment annotations/labels to the webhooks Deployment. |
| keda/README.md | Documents the new per-component Deployment annotation/label values. |
Suppressed comments (3)
keda/templates/manager/deployment.yaml:22
tplrendersdeploymentLabelsas a template. This differs from existingpodLabels(plaintoYaml) and can cause unexpected render errors when label values contain literal{{ ... }}. Prefer rendering labels as plain YAML unless templating is required and documented.
{{- with .Values.deploymentLabels.keda }}
{{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
keda/templates/metrics-server/deployment.yaml:22
tplrendersdeploymentLabelsas a template, which is inconsistent with existingpodLabelsusage and can trigger render errors if values contain literal{{ ... }}. Prefer plaintoYamlunless templating is explicitly desired.
{{- with .Values.deploymentLabels.metricsAdapter }}
{{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
keda/templates/webhooks/deployment.yaml:23
tplrendersdeploymentLabelsas a template. To stay consistent withpodLabelsbehavior and avoid unexpected render failures when values contain literal{{ ... }}, render with plaintoYamlunless templating is explicitly desired.
{{- with .Values.deploymentLabels.webhooks }}
{{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| {{- with .Values.deploymentAnnotations.keda }} | ||
| {{- tpl (toYaml .) $ | nindent 4 }} | ||
| {{- end }} |
There was a problem hiding this comment.
Both halves of this are correct, and I verified them rather than taking them on trust:
# same literal value in both fields
$ helm template keda ./keda -f literal.yaml | grep note:
note: '{{ hello }}' # podAnnotations (toYaml) -> preserved
note: 'Hello!' # deploymentAnnotations (tpl) -> evaluatedSo the inconsistency with podAnnotations is real, and an unparseable value is a hard failure rather than a warning:
$ helm template keda ./keda --set-string 'deploymentAnnotations.keda.note={{ .Broken'
Error: ... error calling tpl: cannot parse template ... bad character U+0027The reason I'm not dropping tpl: it's the requested feature, not an implementation detail — @mindw asked for it in review of 2026-07-16 so {{ .Release.Name }} can be used in these values, and it shipped in b0daa8b. And because deploymentAnnotations / deploymentLabels are new in this PR, there is no existing user with a literal {{ ... }} to break — which is exactly what separates them from podAnnotations, where toYaml can't be changed without breaking people.
You end your comment with "unless templating is intentional and documented". It is intentional, and it's now documented — 9a23e6b:
# Values here are rendered through `tpl`, so `{{ ... }}` is evaluated as a template.
# Escape it as `{{ "{{" }} ... }}` if you need a literal.
deploymentAnnotations:
# -- Deployment annotations for KEDA operator. Rendered through `tpl`Escape hatch verified: note: '{{ "{{" }} hello }}' renders as note: '{{ hello }}'. All six rows updated in values.yaml and README.md.
@JorTurFer — this is the same question as your "why tpl here?" thread, so it's your call in the end: keep tpl as @mindw asked, or drop it for consistency with podAnnotations. It's a three-line revert either way and I'm happy to do whichever you prefer.
| {{- with .Values.deploymentAnnotations.metricsAdapter }} | ||
| {{- tpl (toYaml .) $ | nindent 4 }} | ||
| {{- end }} |
There was a problem hiding this comment.
Same point as the operator-deployment thread — answered there, and documented in 9a23e6b. Short version: the tpl behaviour is intentional (it's what @mindw asked for) and these values are new in this PR so nothing existing breaks, but it is now spelled out in values.yaml and the README along with the {{ "{{" }} escape.
| {{- with .Values.deploymentAnnotations.webhooks }} | ||
| {{- tpl (toYaml .) $ | nindent 4 }} | ||
| {{- end }} |
There was a problem hiding this comment.
Same point as the operator-deployment thread — answered there, and documented in 9a23e6b. Short version: the tpl behaviour is intentional (it's what @mindw asked for) and these values are new in this PR so nothing existing breaks, but it is now spelled out in values.yaml and the README along with the {{ "{{" }} escape.
Signed-off-by: somaz <genius5711@gmail.com>
9a23e6b to
fbbcf7e
Compare
|
@JorTurFer thanks for the approval on Aug 11 — checking in on what's left here. CI is green and there are no outstanding review threads: @mindw's GitHub still reports the PR as blocked, which I assume is a second approval or a merge window rather than anything on my side — but let me know if there's something I've missed and I'll get to it. |
wozniakjan
left a comment
There was a problem hiding this comment.
I'd personally structure this differently, there is already additionalAnnotations so instead of deploymentAnnotations.operator, I'd put it as operator.additionalAnnotations where some of component specific overrides already live, somewhere in this block:
Lines 98 to 169 in 1444d00
same for other components and labels
|
Thanks for taking a look @wozniakjan. Before I move these, can I check the premise with you? I think There are two
The And the global one isn't in competition with this PR; the two already compose: $ helm template keda ./keda \
--set-string 'additionalAnnotations.global-one=yes' \
--set-string 'deploymentAnnotations.keda.per-component=yes'
...
kind: Deployment
metadata:
name: keda-operator
annotations:
global-one: "yes"
per-component: "yes"What I did mirror is podAnnotations:
keda: {}
metricsAdapter: {}
webhooks: {}
deploymentAnnotations: # this PR
keda: {}
metricsAdapter: {}
webhooks: {}One consequence worth weighing before you decide: the component blocks are Genuinely happy either way, it's your chart. If you'd still prefer the per-component blocks I'll restructure all six renders plus |
What
Adds top-level
deploymentLabelsanddeploymentAnnotationsvalues, keyed per component (keda/metricsAdapter/webhooks), and wires them into themetadata.labels/metadata.annotationsof 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 distinctservice(operator/metrics-apiserver/webhook).This mirrors the existing per-component
podLabels/podAnnotationsinterface exactly, so the shape is already familiar: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/podAnnotationsmap style or move toward a{component}.foo.barnested style. I went with the existing top-level map style here for consistency withpodLabels/podAnnotationsand 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 kedapasses.main(new keys default to{}, so existing installs see no change).helm templatewith the values above mergesadditionalAnnotations+ per-componentdeploymentAnnotations, and appends per-componentdeploymentLabels, on all three Deployments.metadata.labels/metadata.annotationson the live specs, and all pods reach Running.keda/Chart.yamlversion intentionally not bumped, per CONTRIBUTING (chart versions are released with KEDA core).Resolves #418