Closed ThoSap closed 1 year ago
Unfortunately, the mapping of env var types only works for string types because system properties are String based properties. Alternatively, what you can do is:
quarkus.mailer.port=${app.mailerPort}
quarkus.helm.values.mailerPort.value-as-int=1000
quarkus.helm.values-schema.properties.mailerPort.minimum=1
quarkus.helm.values-schema.properties.mailerPort.maximum=65535
quarkus.helm.values-schema.properties.mailerPort.type=integer
Quarkus Helm will bind the Quarkus property with the Helm values automatically by you, so you don't need to provide the path. Can you give it a try? I hope it helps!
Got it, but why do other env var strings not end up being quoted, but boolean and numeric types are quoted?
The issue would be fixed, if the boolean
and numeric
values are not quoted in file values.yaml
.
See the following example:
This is due to historic reasons, as I'm an OG Quarkiverse Helm user since 0.1.2 😉 I will remove the manual path mapping,
Got it, but why do other env var strings not end up being quoted, but boolean and numeric types are quoted?
This indeed works as you stated from https://github.com/quarkiverse/quarkus-helm/pull/230. For String values, it's not quoted. However, having a deeper look, perhaps this was a bad idea from my side. I will fix it asap.
It seems the quoted
is indeed necessary, otherwise we got:
Error: INSTALLATION FAILED: Deployment in version "v1" cannot be handled as a Deployment: json: cannot unmarshal bool into Go struct field EnvVar.spec.template.spec.initContainers.env.value of type string
So, the env var values only accept string values.
Since using env-var won't work with String values, I recommend you to use https://quarkus.io/guides/kubernetes-config to provide configuration from a configMap. Then, you can map the values within the configMap with the generated Helm chart.
I've created a new example to better explain how to map properties that are not a string. Feel free to have a look into this.
Hi,
first of all I'm using Quarkus
3.1.2.Final
and Quarkiverse Helm1.0.8
. For the configuration file, I'm not usingapplication.properties
, butapplication.yml
(https://quarkus.io/guides/config-yaml).Today I wanted to make a clean configuration for the new
values.schema.json
file, for example for the Quarkus runtime propertyQUARKUS_MAILER_PORT
. As this is a port number, the type must be an integer and must be between0
(or1
as0
is a reserved port) and65535
.As boolean and numeric types must be quoted for K8s Pod environment variables, I added the following workaround with an expression
If we do not add this workaround, the Helm deploy or the K8s Deployment fails with
For the Helm values.schema.json validation, I added the following properties
but no matter what I try, the value in the values.yaml is always generated as a string
therefore, the schema Helm
values.schema.json
validation fails with when I want to deploy the Helm instance.In my YAML
application.yml
instead ofapplication.properties
the K8s/Helm configuration is configured as follows (many unrelated properties are missing in this example for brevity):