[common]: add generic annotations field for resource-level metadata.annotations - #190
Merged
Merged
Conversation
…nnotations Signed-off-by: Reto Kupferschmid <kupferschmid@puzzle.ch>
rekup
marked this pull request as ready for review
August 18, 2026 08:14
wthhub
approved these changes
Aug 18, 2026
wthhub
left a comment
Contributor
There was a problem hiding this comment.
Looks good, thanks for contributing!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does:
Adds a generic
annotationsfield to thecommonchart so top-levelmetadata.annotationscan be set on generatedJob,CronJob,Deployment,StatefulSet, andServiceresources. 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 existingcontroller.extraAnnotationsonly targets the Pod template, not the resource itself.Changes:
library.annotationshelper intemplates/helpers/_labels.tpl(wraps the existinglibrary.mapifyhelper with anannotations:key).annotationswired into_job.yaml,_cronjob.yaml,_deployment.yaml,_statefulset.yaml, and_service.yaml.values.schema.jsonupdated to allowannotationsundercontrollerandservices.*.values.yaml.ci/values.test.yamlextended to exercise the new field.Chart.yaml: version bumped to 12.11.0,artifacthub.io/changesentry added referencing [common] Add generic annotations to control Helm hooks/execution order #189.README.mdregenerated viamake helm-docs(version badge only).Which issue this PR fixes
fixes #189
Notes for Reviewer:
annotations(new) vs.extraAnnotations(existing): the former setsmetadata.annotationson the resource itself, the latter setsspec.template.metadata.annotationson the Pod template. Please double-check naming makes this distinction clear.values.yaml): the newcontroller.annotations/services.*.annotations(and the existingcontroller.extraAnnotations) render each value throughtplagainst the root context (vialibrary.mapify), so e.g."{{ .Release.Name }}"gets expanded.ingresses.*.annotationsandpvcs[].annotationspredate this feature and render values as-is via a plaintoYaml(notpl). 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-establishedextraAnnotations/extraLabelsconvention. Added comments invalues.yamlon all four annotation fields cross-referencing this difference.Checklist:
[chart]: Changed SomethingREADME.md.gotmplfile and executedhelm-docs