feat(chart): expose deployment/job/cronJob annotations for workload metadata#75
Merged
Merged
Conversation
bryantbiggs
force-pushed
the
feat/chart-deployment-annotations
branch
from
May 1, 2026 22:18
5a6e467 to
be1e04d
Compare
…etadata
Adds three mode-gated values rendered onto metadata.annotations of the
top-level workload:
deploymentAnnotations - Deployment (mode: watch)
cronJobAnnotations - CronJob (mode: cronjob)
jobAnnotations - Job (mode: job)
Pod-template annotations remain unchanged via podAnnotations.
Each value targets concrete real-world use cases at the workload level,
which are distinct from pod-template annotations and would silently fail
under the latter:
Deployment - Stakater Reloader, Argo Rollouts notification subscriptions
CronJob/Job - Helm lifecycle hooks (helm.sh/hook), Argo CD sync-wave
and hook annotations, Kyverno/Gatekeeper policy selectors,
cost-allocation tags
Naming and shape mirror the kubernetes-sigs/descheduler chart, which
exposes the same triad alongside podAnnotations across the same multi-
mode rendering pattern. cert-manager exposes startupapicheck.jobAnnotations
defaulting to Helm hook annotations for the same reason.
Closes #74.
bryantbiggs
force-pushed
the
feat/chart-deployment-annotations
branch
from
May 1, 2026 22:37
be1e04d to
2b1be65
Compare
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.
Closes #74.
Summary
Adds three mode-gated values rendered onto
metadata.annotationsof the top-level workload, distinct frompodAnnotations:deploymentAnnotationsmode: watchcronJobAnnotationsmode: cronjobjobAnnotationsmode: jobEach is independently mode-gated, so values for inactive modes never render. Pod-template annotations remain unchanged under
podAnnotations.Naming and shape
The original issue proposed a single
workloadAnnotations. After surveying mainstream charts the three-value shape is the established convention for charts that render multiple workload kinds:deploymentAnnotations+cronJobAnnotations+jobAnnotations+podAnnotationsside by side.startupapicheck.jobAnnotationsdefaults tohelm.sh/hook: post-installplushelm.sh/hook-weightandhelm.sh/hook-delete-policy. Helm hook annotations only function on the workload's own metadata, not the pod template.values.yamlfiles in public repos use one or more of the same three keys.workloadAnnotationshas no precedent in any popular chart. A bare top-levelannotations:was rejected becauseserviceAccount.annotationsalready exists atvalues.yaml:24and would create an ambiguous pair next topodAnnotations.Why workload-level annotations matter for Job/CronJob (not just Deployment)
Reloader does not watch Jobs or CronJobs, so its motivation does not extend. The justification for the Job/CronJob slots is independent:
helm.sh/hook: post-install,helm.sh/hook-delete-policy,helm.sh/hook-weight) — these only function on the workload's ownmetadata.annotations. cert-manager's startupapicheck Job is the canonical example.argocd.argoproj.io/sync-waveandargocd.argoproj.io/hookare read from the resource's own metadata. Sync-wave on a CronJob (e.g. ordering DB migration before app rollout) is a normal Argo pattern.None of these need Reloader. All of them need the workload's own metadata, not the pod template's.
Mid-sync runtime safety
Editing
metadata.annotationsdoes not signal the running Pod or restart any in-flight sync. For each mode:mode: watch— annotations on the Deployment are not part of the pod-template hash, sokubectl patchdoes not roll the workload. The exception isreloader.stakater.com/auto: "true"paired with a ConfigMap/Secret rotation, which causes Reloader to mutate the pod-template annotation and roll the Deployment. Safe-by-design: ocync's transfer state cache and digest skip-detection allow the new pod to resume work and skip already-uploaded blobs.mode: cronjob— annotations on the CronJob'smetadataare independent of any spawned Job. PatchingcronJobAnnotationswhile a sync runs has no effect on the running Job. Affects only Argo's reconcile view, Helm's hook lifecycle, policy controllers, etc.mode: job— annotations on the Job'smetadataare read-only from the runtime's perspective. Patching mid-run does not signal the pod or restart anything.Example
Test plan
helm-unittestcovers all three modes with positive (real annotation values:helm.sh/hook,argocd.argoproj.io/sync-wave,reloader.stakater.com/auto) and negative cases — 60/60 pass (added 8 new cases)deploymentAnnotationsis not rendered inmode: cronjob,jobAnnotationsis not rendered inmode: watchhelm templateend-to-end render verified for each mode with a real annotation sethelm templatewith no override produces nometadata.annotationsblock on any workloadhelm lint charts/ocynccleanhelm-docsregenerated;charts/ocync/README.mdincludes all three new values