Use annotations with special characters #10277
-
Hello, I did not find my answer in the documentation or in any issue, please redirect me if I can find it anywhere. In an Now, I have an annotation with dot and slashed, like spec:
source:
repoURL: '…'
path: 'manifests/overlays/{{metadata.annotations["app.project.com/overlay"]}}' I tried multiple syntaxes, each do not work:
Some my questions are:
Thanks in advance for any help! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@sambonbonne the current templating logic is super simplistic: I think you could simply use In 2.5, accessing parameters as go structures will be possible, so folks will end up using something like I'd welcome a PR! A quick note about how this will work with go templating would also be appreciated, if you have time. :-) |
Beta Was this translation helpful? Give feedback.
-
Thanks @crenshaw-dev! I didn't know it was that simple. I don't know much about go templating so IDK if I'll be able to write a note about it but I'll try to do something :) Thanks again! |
Beta Was this translation helpful? Give feedback.
@sambonbonne the current templating logic is super simplistic:
https://github.com/argoproj/argo-cd/blob/master/applicationset/generators/cluster.go#L141-L143
I think you could simply use
metadata.annoations.app.project.com/overlay
. Under the hood, the template "key" is a simple string, so fasttemplate should interpret that whole string as one "thing" and replace it with the annotation value.In 2.5, accessing parameters as go structures will be possible, so folks will end up using something like
{{ index .metadata.annotations "app.project.com/overlay" }}
. For fasttemplate (the default and, in <=2.4 the only, option),{{ metadata.annoations.app.project.com/overlay }}
is the way to go.I'd …