-
Notifications
You must be signed in to change notification settings - Fork 10
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
The generated chart doesn't handle well environment variables created by the quarkus kubernetes extension for init tasks #292
Comments
Unfortunately, this is a limitation of the Helm client by Go.
Let me know if this makes the generated Chart work for you. I will keep the issue open just in case there are a better solution for this issue. |
I confirm the suggested solution works properly. What I had in mind, was that for "well-known" environment variables generated by other extensions, quarkus helm could force the type. It would introduce an indirect coupling with the quarkus-flyway extension (and other extensions in the future) so perhaps you do not want to go down this road (and I totally understand)! Thanks for your work on this extension! |
Indeed, that's why I'm reluctant to do something like this. More taking into account that this is a really Helm CLI issue that they might fix in the future and also because it seems weird to me that the Quarkus Flyway (or Liquibase) extensions automatically add this env var property. |
I totally understand :) In fact, I need to dig a bit deeper when I have some time, but I think there is a problem with this approach, since Back to the issue at hand, as far as I'm concerned, you're proposed workaround is alright! |
I had not noticed that "quarkus.flyway.enabled" was a build-time property, then the env var seems wrong for sure. Actually, in Quarkus 3.2, this property was not a build-time property, so maybe this is a leftover. Thanks for digging into this! |
Great, thanks! |
@Sgitario I just hit this as well. I don't get why there was mention of handling well-known environment variables. All environment variables must be strings anyway, that's what the error message is telling us. With that in mind, can't the Helm extension at least force quoting for all environment variables? What I mean is that it currently replaces this:
with this:
Can't it replace it with this instead?
Or are you saying the Helm extension doesn't have the context it needs to detect, upon replacement, that it's replacing an environment variable? |
@yrodiere the Quarkus Helm extension is already adding the
The "20" is a string, so that's why the quote is not added. However, the Helm client (again) interprets "20" as a number and hence we have the problem. I was reluctant to always add the quote for env vars because (1) this is a limitation of the Helm client that we don't hit if we don't use it and (2) users might add a non-string env var and then it won't work as they expect. |
Do you mean there are other ways to use Helm charts than through the Helm client? 😕
Are you sure they can? Environment variables are always strings as far as I can tell... the Kubernetes YAML schema just doesn't allow anything other than strings there. See https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#environment-variables
+1 from me, because I don't think users from (2) even exist :D |
About (2), the problem I foresee is that users using boolean or integers would expect to inject types as such. Before adding the Having said that, I also expect (2) is not even a real concern! |
When adding quarkus-flyway to my project, quarkus-kubernetes creates an init task (see https://quarkus.io/guides/flyway#flyway-on-kubernetes). This init task comes with an environment variable
QUARKUS_FLYWAY_ENABLED
. It seems the type of the environment variable is incorrect, since when installing the chart generated with quarkus-helm, I end up with:Looking into the resources generated by quarkus-kubernetes, I can see that the type looks correct:
In the chart generated by quarkus-helm I see:
With the following in the values file:
(which looks good to me).
Finally the schema also looks good:
I tried overwriting the value when installing the chart with
--set-string
, with no luck...I managed to reproduced on a minimal example:
kubectl
context to a test clustermvn package && helm upgrade --install bug target/helm/kubernetes/<artifact>
For convenience I uploaded a reproducer: https://github.com/PierreBtz/quarkus-flyway-helm-bug.
Upon installing the chart, you should see:
The text was updated successfully, but these errors were encountered: