Ingress annotation inputs should always be quoted #483
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In the Ingress object, I would like to use this annotation:
ingress.annotations.nginx.ingress.kubernetes.io/use-regex: true
When adding the annotation above, the Chart breaks. If I quote the value like this \'true\', the value is accepted, but the value in the Kubernetes Ingress object becomes '''true'''. I'm not sure if that will evaluate to the boolean value of true?
Maybe the values should be quoted here ?
https://gitea.com/gitea/helm-chart/src/branch/main/templates/gitea/ingress.yaml#L20
I'm using Helmsman to deploy the Gitea chart.
Any suggestions much appreciated. Thanks.
The following works for me
It's probably related to me using Helmsman. If quoting the values for annotations in the chart solves the problem, would you accept a PR for that?
I don't see how the chart is the issue here. The values are forwarded verbatim, so you should be able to supply any kind of quoting yourself. In the end it's YAML and any tool should interpret it the same way.
Can you double-check this? I don't know helmsman but I also suspect it might not be the issue. Last, you could try directly via helm and and possibly sort out the issue with helmsman then.
Thanks. I'll investigate and report back.
@tobiasbp any news here?
I'm using Helmsman to deploy. Helmsman uses the --set option in Helm to set values in the chart.
The following demonstrates the issue by using Helm to add an annotation to the Ingress object.
Only string values accepted
Setting an annotation in the Ingress object with a string value works:
Setting an annotation in the Ingress object with a integer value does not work:
Setting an annotation in the Ingress object with a boolean value does not work:
Using quoted non string values
I can put quotes around a non string value, and the annotation will be added:
This will add this annotation to the Ingress object:
That value is not honored as 100. I have to manually edit the Ingress object in the Kubernetes cluster to make it look like this (A single set of "), to make the annotation work (ingress uses the value):
Proposed solution
Current version of the Chart adds annotations like this:
Adding annotations like this, allows all types of values to be used in annotations:
Example of using an integer as value with proposed solution:
Example of setting a boolen value for an annotation with dots in name:
According to the ingress-nginx documentation values for annotations must be quoted.
Thanks for the extensive research.
I haven't found any ingress annotation definition of mine where I needed a numeric values being treated as such. All numeric inputs (e.g. IP definitions) were correctly used behind the scenes when quoted. Yet I have
nginx.ingress.kubernetes.io/use-regex: "true"
in some definitions and using quoted inputs for booleans seems to also work as desired behind the scenes.I wonder what influence
helmsman
plays here and to what degree this is caused byhelm
itself? Why can't you use unescaped quotes inhelmsman
? Ref your example--set ingress.annotations.foo-bar/some-parameter=\"100\"
. Does this restriction only apply to numerics but not to booleans, i.e. the latter still work as desired?I am ok with this change as it should only make things more flexible AFAICS. Do you want to create a PR?
I'd like to add a PR, however my private SSH key (ssh-rsa) is not accepted when i try to add it to my gitea.com account?
Cannot verify your SSH key: key length is not enough: got 2024, needs 2047
https://github.com/go-gitea/gitea/issues/20249
Feel free to add my suggested change since I can not easily do it.
What key type is it? The linked issue is very old, I doubt this one applies.
Might be worth opening a new issue or creating a new keypair for gitea.com?
I have created a new ssh-rsa keypair with
ssh-keygen -t rsa
. I have added the new public key to my https://gitea.com/gitea account. The public key I use in other places is also ssh-rsa. The new public key is longer than the older one.I'll create a PR with the changes to ingress annotations.
Why
-t rsa
and not use the new default Ed25519 if you have issues with rsa?Added a PR: https://gitea.com/gitea/helm-chart/pulls/497