Skip to content

[common]: add generic annotations field for resource-level metadata.annotations - #190

Merged
wthhub merged 1 commit into
bedag:masterfrom
rekup:feat/resource-annotations
Aug 18, 2026
Merged

[common]: add generic annotations field for resource-level metadata.annotations#190
wthhub merged 1 commit into
bedag:masterfrom
rekup:feat/resource-annotations

Conversation

@rekup

@rekup rekup commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

What this PR does:
Adds a generic annotations field to the common chart so top-level metadata.annotations can be set on generated Job, CronJob, Deployment, StatefulSet, and Service resources. This enables use cases like Helm hook annotations (helm.sh/hook, helm.sh/hook-weight, helm.sh/hook-delete-policy) that were not previously possible, since the existing controller.extraAnnotations only targets the Pod template, not the resource itself.

Changes:

  • New library.annotations helper in templates/helpers/_labels.tpl (wraps the existing library.mapify helper with an annotations: key).
  • annotations wired into _job.yaml, _cronjob.yaml, _deployment.yaml, _statefulset.yaml, and _service.yaml.
  • values.schema.json updated to allow annotations under controller and services.*.
  • Documentation and examples added to values.yaml.
  • ci/values.test.yaml extended to exercise the new field.
  • Chart.yaml: version bumped to 12.11.0, artifacthub.io/changes entry added referencing [common] Add generic annotations to control Helm hooks/execution order #189.
  • README.md regenerated via make helm-docs (version badge only).

Which issue this PR fixes
fixes #189

Notes for Reviewer:

  • annotations (new) vs. extraAnnotations (existing): the former sets metadata.annotations on the resource itself, the latter sets spec.template.metadata.annotations on the Pod template. Please double-check naming makes this distinction clear.
  • Templating inconsistency (now documented in values.yaml): the new controller.annotations/services.*.annotations (and the existing controller.extraAnnotations) render each value through tpl against the root context (via library.mapify), so e.g. "{{ .Release.Name }}" gets expanded. ingresses.*.annotations and pvcs[].annotations predate this feature and render values as-is via a plain toYaml (no tpl). I deliberately did not change the Ingress/PVC behavior to add templating, since that would be a silent, potentially breaking behavior change for any existing user who has literal {{ ... }}-looking strings in those annotations today. The new fields instead follow the already-established extraAnnotations/extraLabels convention. Added comments in values.yaml on all four annotation fields cross-referencing this difference.

Checklist:

  • Pull Request title in format [chart]: Changed Something
  • Updated documentation in the README.md.gotmpl file and executed helm-docs
  • Chart Version bumped
  • All commits are signed-off

…nnotations

Signed-off-by: Reto Kupferschmid <kupferschmid@puzzle.ch>
@rekup
rekup marked this pull request as ready for review August 18, 2026 08:14
@rekup
rekup requested review from a team as code owners August 18, 2026 08:14

@wthhub wthhub left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for contributing!

@wthhub
wthhub merged commit a27d3f4 into bedag:master Aug 18, 2026
2 checks passed
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.

[common] Add generic annotations to control Helm hooks/execution order

2 participants