New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Post selector with Go templates in ApplicationSet #13584
fix: Post selector with Go templates in ApplicationSet #13584
Conversation
9d55774
to
ff72202
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #13584 +/- ##
==========================================
- Coverage 49.17% 49.16% -0.02%
==========================================
Files 248 248
Lines 42872 42881 +9
==========================================
- Hits 21084 21083 -1
- Misses 19687 19695 +8
- Partials 2101 2103 +2
☔ View full report in Codecov by Sentry. |
I've made a slight addition to my original commit for this to create a generic map flattening function as this would also be useful for supporting nested keys in the merge generator |
Thanks so much for this PR! And yes, fixing |
541bef1
to
6a0ab9f
Compare
@crenshaw-dev I've rebased this PR and there looks to be some issues with the recently merged in test changes you did on the matrix generator as part of m13t@fafee48. Can't understand why the changes in the PR you merged worked but do not in my branch. Seems as though the non-go template variables are not being interpolated. Any ideas? |
Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk>
…ng function Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk>
Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk>
Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk>
6a0ab9f
to
e90a476
Compare
@crenshaw-dev rebased and all working again now. This is good to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful, thanks @m13t!
/cherry-pick release-2.7 |
Cherry-pick failed with |
/cherry-pick release-2.6 |
Cherry-pick failed with |
/cherry-pick release-2.5 |
Cherry-pick failed with |
@m13t would you mind opening PRs against release-2.5, release-2.6, and release-2.7? Cherry-pick bot is finicky. |
…roj#13584) * fixes argoproj#12524 Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * refactor keepOnlyStringLabels function into more generic map flattening function Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * updated USERS.md Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> * use flatten library to replace custom flatten function Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> --------- Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk>
…roj#13584) * fixes argoproj#12524 Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * refactor keepOnlyStringLabels function into more generic map flattening function Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * updated USERS.md Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> * use flatten library to replace custom flatten function Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> --------- Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk>
…roj#13584) * fixes argoproj#12524 Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * refactor keepOnlyStringLabels function into more generic map flattening function Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * updated USERS.md Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> * use flatten library to replace custom flatten function Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> --------- Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk>
@crenshaw-dev manual cherry-picked PRs are in |
…y-pick #13584) (#13822) * fix(appset): Post selector with Go templates in ApplicationSet (#13584) * fixes #12524 Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * refactor keepOnlyStringLabels function into more generic map flattening function Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * updated USERS.md Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> * use flatten library to replace custom flatten function Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> --------- Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> * fix merge Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * re-add deleted test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
…y-pick #13584) (#13823) * fix(appset): Post selector with Go templates in ApplicationSet (#13584) * fixes #12524 Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * refactor keepOnlyStringLabels function into more generic map flattening function Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * updated USERS.md Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> * use flatten library to replace custom flatten function Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> --------- Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> * fixed tests Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> --------- Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk>
…y-pick #13584) (#13824) * fix(appset): Post selector with Go templates in ApplicationSet (#13584) * fixes #12524 Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * refactor keepOnlyStringLabels function into more generic map flattening function Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * updated USERS.md Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> * use flatten library to replace custom flatten function Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> --------- Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> * fixed tests Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * fixed missing import Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> --------- Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk>
…y-pick argoproj#13584) (argoproj#13822) * fix(appset): Post selector with Go templates in ApplicationSet (argoproj#13584) * fixes argoproj#12524 Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * refactor keepOnlyStringLabels function into more generic map flattening function Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * updated USERS.md Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> * use flatten library to replace custom flatten function Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> --------- Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> * fix merge Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * re-add deleted test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: schakrad <58915923+schakrad@users.noreply.github.com>
…roj#13584) * fixes argoproj#12524 Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * refactor keepOnlyStringLabels function into more generic map flattening function Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * updated USERS.md Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> * use flatten library to replace custom flatten function Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> --------- Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk>
…roj#13584) * fixes argoproj#12524 Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * refactor keepOnlyStringLabels function into more generic map flattening function Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> * updated USERS.md Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> * use flatten library to replace custom flatten function Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk> --------- Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk> Signed-off-by: Lewis Marsden-Lambert <lewis.marsden-lambert@smartpension.co.uk>
This PR fixes #12524 by allow users to reference nested properties when using Go template syntax in application sets. Previously only top-level string keys could be used as post selectors. When matching labels, this PR will now allow referencing nested keys by concatenating each key with a dot (
.
).The original match values tests have been duplicated with Go templates enabled to provide more extensive tests.
Checklist: