fix: use constant name for schema job to enable proper hook cleanup#916
Open
celestegambardella wants to merge 1 commit into
Open
fix: use constant name for schema job to enable proper hook cleanup#916celestegambardella wants to merge 1 commit into
celestegambardella wants to merge 1 commit into
Conversation
700fb15 to
3023cc2
Compare
The schema job name previously included Chart.Version and Release.Revision, which caused the job name to change on every upgrade. This prevented 'before-hook-creation' delete policy from cleaning up old jobs since Helm treats differently-named resources as unrelated. Using a constant job name ensures proper cleanup during upgrades and prevents manual job deletion during version upgrades. Fixes hook cleanup issue with pre-install,pre-upgrade schema jobs.
3023cc2 to
3460624
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.
The schema job name previously included Chart.Version and Release.Revision, which caused the job name to change on every upgrade. This prevented 'before-hook-creation' delete policy from cleaning up old jobs since Helm treats differently-named resources as unrelated. Using a constant job name ensures proper cleanup during upgrades and prevents manual job deletion during version upgrades. Fixes hook cleanup issue with pre-install,pre-upgrade schema jobs.
What was changed
Changed the schema job name from a dynamic name including
Chart.VersionandRelease.Revisionto a constant name based only on the release name.Before
{{ $jobName := include "temporal.componentname" (list $ (printf "schema-%s-%d" $.Chart.Version $.Release.Revision | replace "." "-" | replace "+" "-")) }}After
{{ $jobName := printf "%s-schema" (include "temporal.fullname" $) }}Why?
The dynamic job name caused the name to change on every upgrade (e.g., temporal-schema-0-62-0-1 → temporal-schema-0-63-0-2). This prevented before-hook-creation delete policy from working because Helm treats
differently-named resources as unrelated.
This resulted in:
• Old completed jobs accumulating in the cluster
• Manual job deletion required during upgrades
• Failed upgrades if jobs with conflicting names exist
Using a constant name ensures before-hook-creation properly cleans up old jobs during upgrades.
Alternative (If Constant Name Is Not Acceptable)
If maintaining dynamic job names is preferred, I can add an option to use post-install,post-upgrade hooks with hook-succeeded delete policy instead:
This would enable automatic cleanup without changing the job naming scheme. Let me know which approach is preferred.
Checklist
• No README updates needed (internal template change)
• May want to mention in upgrade notes that schema job name format changed