fix: omit empty CRD metadata in helm chart - #126
Open
pyd-07 wants to merge 1 commit into
Open
Conversation
Signed-off-by: pyd-07 <piyush.24448@knit.ac.in>
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.
Explanation
This PR fixes a bug in the
kyverno-apiHelm chart where CRDs were rendered with emptymetadata.labelsandmetadata.annotationsmaps when no custom metadata was configured. These empty maps can cause Argo CD to continuously report the CRDs asOutOfSynceven though there is no meaningful difference.Related issue
Fixes kyverno/kyverno#17276
Proposed Changes
labelsandannotationsconditional on.Values.labelsand.Values.annotations.kyverno-apiCRD Helm templates with the corrected generation logic.make helm-testregression check covering both default and explicitly configured metadata.Checklist
Further Comments
The issue was caused by the CRD generation step unconditionally injecting the
labelsandannotationstemplate blocks. Since both chart values default to empty maps, Helm rendered them as{}.The fix keeps the existing metadata configuration mechanism but only emits the fields when values are actually provided. The regression test verifies that the fields are omitted with default values and preserved when explicitly configured.