-
Notifications
You must be signed in to change notification settings - Fork 187
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
Document how to use numbers and booleans in post build substitutions #1129
Conversation
Signed-off-by: Stefan Prodan <[email protected]>
Signed-off-by: Stefan Prodan <[email protected]>
Stefan, we use quoted int and bool and it works fine with latest flux version (ie it renders as a double quoted string containing the numeric or bool value) enabled: "'true'" |
The problem with this |
not really a problem because for string, the variable value should just be defined in ConfigMap as usual without need for any quoting (or with the regular quoting) |
@ahothan your solution doesn't work, using |
we would not be using "'${number}'" at all example of definitions in configmap that should all result in a string being rendered number: "'100'" and the reference from any flux yaml file (can be in values of HelmRelease or in any part of k8s manifest): text1: ${text} rendered: text1: anytext_that_is_not_int_or_bool I have not tried it on a metadata label but it should work |
I think this works better...
renders
better than having |
So... there is still no clean solution? This doesn't work for many cases, like substitutions from configmaps |
@nick4fake I don't see why substitutions from ConfigMaps would not work with the solution present in the docs. You can configure it like this: spec:
postBuild:
substitute:
quote: '"'
substituteFrom:
- kind: ConfigMap
name: cluster-vars |
I'm not sure it works:
The funny thing is:
And the values are:
So it fails as a string and as int too. lol |
When using post build substitutions with vars that are numbers or booleans, the reconciliation may fail if the substitution
is for a field that must be of type string. This PR adds a section to the API docs on how to use double quotes vars, and adds unit tests for this procedure.
Fix: fluxcd/flux2#4154
Fix: fluxcd/flux2#1839
Fix: #1096
Fix: #728
Fix: #554