fix(applicationset): use pointer type for generator Template fields to honor omitempty#26632
Open
HsiuChuanHsu wants to merge 6 commits intoargoproj:masterfrom
Open
fix(applicationset): use pointer type for generator Template fields to honor omitempty#26632HsiuChuanHsu wants to merge 6 commits intoargoproj:masterfrom
HsiuChuanHsu wants to merge 6 commits intoargoproj:masterfrom
Conversation
…o honor omitempty Signed-off-by: HsiuChuanHsu <hchsu2106@gmail.com>
…for pointer Template Signed-off-by: HsiuChuanHsu <hchsu2106@gmail.com>
Signed-off-by: HsiuChuanHsu <hchsu2106@gmail.com>
Signed-off-by: HsiuChuanHsu <hchsu2106@gmail.com>
🔴 Preview Environment stopped on BunnyshellSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
Author
14 tasks
Signed-off-by: HsiuChuanHsu <hchsu2106@gmail.com>
Signed-off-by: HsiuChuanHsu <hchsu2106@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.



WHY
The Problem: Users have a generator in ApplicationSet without a generator-level template, but an empty template structure would be automatically added.
What
The
Templatefields in ApplicationSet generator structs were defined as value types. Because of this,omitemptyin the JSON tags had no effect.argo-cd/pkg/apis/application/v1alpha1/applicationset_types.go
Lines 609 to 628 in ff83056
How
This PR changes the
Templatefields to pointer types (*ApplicationSetTemplate). When a template is not set, the field becomesnil, which Go correctly treats as empty. This allowsomitemptyto work as intended and prevents unintended merges.Changes:
Templatefields in generator structs from value types to pointer types inpkg/apis/application/v1alpha1/applicationset_types.goGetTemplate()to handle the new pointer types safelymergeGeneratorTemplate()to handle the new pointer types safelyapplicationset/generators/generator_spec_processor.goFix: #24647
Checklist: