-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Post selectors broken when using goTemplate: true #12524
Comments
I'm also facing this problem, and I cannot disable Go templating, because I use dynamic list generator (v2.7.0rc2):
Someone please look into this bug. |
So this looks to be that the labels are being filtered out if they contain nested properties and only top-level string key value pairs are being kept. I’m not overly familiar with the codebase but at a quick glance this looks like for the generator spec function that filters these out, you could simply dot append the keys for nested values rather than discard them. I’m happy to put a PR in for this assuming there aren’t some wider ramifications I’m unaware of? |
This is the error message from ApplicationSet controller when I apply the ApplicationSet manifest above:
|
I think that's expected as the label isn't expecting a Go template expression there. |
I'm not super familiar with how this bug is working under the hood. But it's definitely a bug. Just an oversight from when we added go templates. I'd be happy to review any PR that makes it possible/intuitive to select when using go templates. |
I think it's to do with the structure of the values is different between Go template and old templates. |
I did some testing, and found that keys that do not contain dots work, but keys with dots don't. This works:
But this doesn't, no applications are generated:
Or we just have to use different syntax for matchExpressions with subkeys? I didn't find any info about it yet. |
@uzemeltetes-doto no it should work with dots but there's a bug. Working on a fix at the moment. |
Signed-off-by: Lewis Marsden-Lambert <lewis.lambert@zserve.co.uk>
* 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>
…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>
…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>
Unfortunately this still seems to be an issue in v2.8.4:
Must use dot prefix because of generator:
|
…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>
Checklist:
argocd version
.Describe the bug
When goTemplate is enabled, the post selectors do not work anymore.
I assume this problem is caused by the params needing to be prefixed with a dot when goTemplate is active, unfortunately prefixing a selectorKey is impossible as this will fail during creation in the library's validation for the requirements
This issue will be the exact same problem, seeing that goTemplate in this case is also enabled. The assumption that keys with dots are completely unsupported is incorrect, when goTemplate is disabled keys with dots work perfectly fine (just not prefixed).
To Reproduce
Simply create an applicationset that uses both goTemplate: true and post selectors, neither version (with or without prefix) will work
Version
ArgoCD v2.6.2
The text was updated successfully, but these errors were encountered: