feat(hatchet-api): optional stable-named Helm hooks for install jobs - #75
Open
DrFaust92 wants to merge 3 commits into
Open
feat(hatchet-api): optional stable-named Helm hooks for install jobs#75DrFaust92 wants to merge 3 commits into
DrFaust92 wants to merge 3 commits into
Conversation
The setup and worker-token Jobs are plain resources named with a randAlphaNum suffix, so they render a new name on every template pass. GitOps controllers (e.g. ArgoCD, which always renders with .Release.IsInstall=true) therefore see a brand-new Job on every reconcile, producing perpetual drift and a pile of orphaned Jobs. Add an opt-in installJobsAsHooks flag (default false, no behaviour change for helm install/upgrade). When true, the setup and worker-token Jobs get stable names and pre-install/pre-upgrade hook annotations with before-hook-creation delete policy, and their Role/RoleBinding become hooks at a lower weight so RBAC exists before the Jobs run. This mirrors the existing pre-upgrade migration hook and lets GitOps users deploy without drift. Signed-off-by: Ilia Lazebnik <ilia.lazebnik@gmail.com>
Signed-off-by: Ilia Lazebnik <ilia.lazebnik@gmail.com>
Signed-off-by: Ilia Lazebnik <ilia.lazebnik@gmail.com>
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.
Problem
The setup and worker-token Jobs (
charts/hatchet-api/templates/setup-job.yaml) are plain resources named with arandAlphaNumsuffix, so they render a new name on every template pass. GitOps controllers like ArgoCD always render with.Release.IsInstall=true, so they see a brand-new Job on every reconcile — producing perpetual drift and a pile of orphaned Jobs in the namespace.Change
Adds an opt-in
installJobsAsHooksflag (defaultfalse→ no behaviour change for a normalhelm install/upgrade).When
true:<fullname>-setup,<fullname>-worker-token)pre-install,pre-upgradehook annotations with abefore-hook-creationdelete policy (respectingretainFailedHooks)Role/RoleBindingbecome hooks at a lower weight so RBAC exists before the Jobs runThis mirrors the existing
pre-upgrademigration hook and lets GitOps users deploy without drift or orphaned Jobs.Note for maintainers
With the flag on, the setup Job runs at hook time referencing the chart ServiceAccount (a normal resource). This matches the assumption the existing
pre-upgrademigration hook already makes. Happy to also gate the ServiceAccount as a hook if you'd prefer full first-helm installcoverage.Testing
helm lintcleaninstallJobsAsHooks=truerender: stable names + hooks on Role, RoleBinding, setup Job, worker-token Job