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
[ApplicationSet] Support Go Templating in spec.generators
#11661
Comments
after digging a little into the code, it seems that goTemplate must be supported in with the following spec, I got a parsing error: spec:
goTemplate: true
generators:
- matrix:
generators:
- git:
repoURL: https://github.com/myrepo.git
revision: master
files:
- path: instances/*/argocd.yaml
- clusters:
selector:
matchLabels:
argocd.argoproj.io/secret-type: cluster
cloud_provider: '{{default "aws" .cloud_provider}}' It fails with the following error:
It seems to failed here when parsing the manifest. |
iirc the problem is that the "second generator" templating is using the old fashioned method of "marshal everything to JSON, template over it, then unmarshal back." It's janky and breaks easily. Instead we should use the same field-wise templating that we use in the |
…11661) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
…11661) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
…12287) * fix: use field-wise templating for child matrix generators (#11661) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * test shouldn't use go template Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * Update applicationset/utils/utils.go Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
…12287) * fix: use field-wise templating for child matrix generators (#11661) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * test shouldn't use go template Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * Update applicationset/utils/utils.go Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
…12287) (#12771) * fix: use field-wise templating for child matrix generators (#11661) * test shouldn't use go template * Update applicationset/utils/utils.go --------- Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
…12287) * fix: use field-wise templating for child matrix generators (#11661) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * test shouldn't use go template Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * Update applicationset/utils/utils.go Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
…rom a git file (#12428) (#12490) * fix: use field-wise templating for child matrix generators (#11661) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * test shouldn't use go template Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * feat: extend List generator with ElementsJsonBase64 Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: proper field name and crd update Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: indentation Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: remove b64 encoding. Based on #12287 Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: generated with codegen Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: reset some of the generated files Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: elementsyaml to cover both yaml and json Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: regenerate code Signed-off-by: laurentiusoica <laurentiu@soica.ro> * Regenerate code Signed-off-by: laurentiusoica <laurentiu@soica.ro> * fix: update ApplicationSet docs Signed-off-by: laurentiusoica <laurentiu@soica.ro> * fix: elementsyaml to elementsYaml to be more consistent with other fields Signed-off-by: laurentiusoica <laurentiu@soica.ro> --------- Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> Signed-off-by: laurentiusoica <laurentiu@soica.ro> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* fix: use field-wise templating for child matrix generators (#11661) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * test shouldn't use go template Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * feat: extend List generator with ElementsJsonBase64 Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: proper field name and crd update Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: indentation Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: remove b64 encoding. Based on #12287 Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: generated with codegen Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: reset some of the generated files Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: elementsyaml to cover both yaml and json Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: regenerate code Signed-off-by: laurentiusoica <laurentiu@soica.ro> * Regenerate code Signed-off-by: laurentiusoica <laurentiu@soica.ro> * fix: update ApplicationSet docs Signed-off-by: laurentiusoica <laurentiu@soica.ro> * fix: elementsyaml to elementsYaml to be more consistent with other fields Signed-off-by: laurentiusoica <laurentiu@soica.ro> * fix: preserve field order Signed-off-by: laurentiusoica <laurentiu@soica.ro> --------- Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> Signed-off-by: laurentiusoica <laurentiu@soica.ro> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
…11661) (argoproj#12287) * fix: use field-wise templating for child matrix generators (argoproj#11661) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * test shouldn't use go template Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * Update applicationset/utils/utils.go Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
…rom a git file (argoproj#12428) (argoproj#12490) * fix: use field-wise templating for child matrix generators (argoproj#11661) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * test shouldn't use go template Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * feat: extend List generator with ElementsJsonBase64 Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: proper field name and crd update Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: indentation Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: remove b64 encoding. Based on argoproj#12287 Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: generated with codegen Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: reset some of the generated files Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: elementsyaml to cover both yaml and json Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: regenerate code Signed-off-by: laurentiusoica <laurentiu@soica.ro> * Regenerate code Signed-off-by: laurentiusoica <laurentiu@soica.ro> * fix: update ApplicationSet docs Signed-off-by: laurentiusoica <laurentiu@soica.ro> * fix: elementsyaml to elementsYaml to be more consistent with other fields Signed-off-by: laurentiusoica <laurentiu@soica.ro> --------- Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> Signed-off-by: laurentiusoica <laurentiu@soica.ro> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
* fix: use field-wise templating for child matrix generators (argoproj#11661) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * test shouldn't use go template Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * feat: extend List generator with ElementsJsonBase64 Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: proper field name and crd update Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: indentation Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: remove b64 encoding. Based on argoproj#12287 Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: generated with codegen Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: reset some of the generated files Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: elementsyaml to cover both yaml and json Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> * fix: regenerate code Signed-off-by: laurentiusoica <laurentiu@soica.ro> * Regenerate code Signed-off-by: laurentiusoica <laurentiu@soica.ro> * fix: update ApplicationSet docs Signed-off-by: laurentiusoica <laurentiu@soica.ro> * fix: elementsyaml to elementsYaml to be more consistent with other fields Signed-off-by: laurentiusoica <laurentiu@soica.ro> * fix: preserve field order Signed-off-by: laurentiusoica <laurentiu@soica.ro> --------- Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Laurentiu Soica <laurentiu@soica.ro> Signed-off-by: laurentiusoica <laurentiu@soica.ro> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Summary
Support Go Templating in ApplicationSet
spec.generators
Motivation
I would like to be able to do some Go Templating on the parameters generated by another generator like in the following example:
Proposal
Implemented in the same way as the support of Go Templating in
spec.template
?The text was updated successfully, but these errors were encountered: