fix: convert one-time jobs to Helm hooks to prevent ArgoCD OutOfSync#899
Open
pinkneyj wants to merge 4 commits into
Open
fix: convert one-time jobs to Helm hooks to prevent ArgoCD OutOfSync#899pinkneyj wants to merge 4 commits into
pinkneyj wants to merge 4 commits into
Conversation
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.
Why
When the following Jobs complete and are deleted, ArgoCD marks the application as
OutOfSyncbecause it expects them to exist as tracked resources:cloudzero-backfillcloudzero-confload(config-loader-job.yaml)cloudzero-helmlesscloudzero-init-certAdditionally, the current approach of embedding a
checksum/configin job names to trigger re-runs on config changes creates resource churn and leaves stale Job objects in the cluster.What
Convert the one-time Jobs to Helm hooks by adding the following annotations:
This means:
before-hook-creationdeletes the previous job run before creating a new one, replacing the need for achecksum/config-based nameThe
CronJobinbackfill-job.yamlis left unchanged as it manages its own lifecycle.Note on previous hook rejection
A comment in
backfill-job.yamlnotes that Helm hooks were previously rejected due to incompatibility withhelm template, ArgoCD, and Flux. This is addressed as follows:--enable-helm-hookshelm template: Hooks are excluded fromhelm templateoutput by design. Users relying onhelm template | kubectl applywill need to handle these jobs separately or usehelm install/upgradedirectlyFiles changed
charts/cloudzero-agent/templates/backfill-job.yaml— Job only (not CronJob)charts/cloudzero-agent/templates/config-loader-job.yamlcharts/cloudzero-agent/templates/helmless-job.yamlcharts/cloudzero-agent/templates/init-cert-job.yamlHow Tested
Validated the following against a live cluster:
Syncedwith no OutOfSync errorshelm upgradeand confirmed hook jobs were recreated as expected via thebefore-hook-creationdelete policycloudzero-backfillCronJob was untouched and continued to run on its configured schedule