Skip to content
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

Quarkus kubernetes sidecars EnvVar do not work #12063

Closed
arturobrzut opened this issue Sep 13, 2020 · 4 comments · Fixed by #12114
Closed

Quarkus kubernetes sidecars EnvVar do not work #12063

arturobrzut opened this issue Sep 13, 2020 · 4 comments · Fixed by #12114
Assignees
Labels
area/kubernetes kind/bug Something isn't working
Milestone

Comments

@arturobrzut
Copy link

Describe the bug
Hi,

I am trying to generate sidecar configs with env variables using quarkus application.properties. I have below in my application.properties.

quarkus.kubernetes-client.trust-certs=true
quarkus.container-image.name=supersonicjava
quarkus.container-image.registry=quay.io
quarkus.container-image.group=arturobrzut

quarkus.kubernetes.sidecars.mariadb.image= mariadb:10.5.5
quarkus.kubernetes.sidecars.mariadb.env-vars.MYSQL_DATABASE.name=my
quarkus.kubernetes.sidecars.mariadb.env-vars.MYSQL_ROOT_PASSWORD.name=pass
quarkus.kubernetes.sidecars.mariadb.env-vars.MYSQL_USER.name=root
quarkus.hibernate-orm.database.generation = drop-and-create

It is supposed to configure env var inside container mariadb in kubernetes.yml. But it is not.
When I set mount points in sidecar or command in sidecar it works, but env variables not
Env variable works on POD level also, but inside sidecar not

Expected behavior
Sidecar container should contain env variable in kubernetes.yml

Actual behavior
Sidecar container does not contain env var

      - image: mariadb:10.5.5
        imagePullPolicy: IfNotPresent
        name: mariadb
        workingDir: ""
      serviceAccount: supersonicjava

To Reproduce
Steps to reproduce the behavior:

  1. Copy below configs in application.properties of a quarkus Kubernetes project
quarkus.container-image.name=supersonicjava
quarkus.container-image.registry=quay.io
quarkus.container-image.group=arturobrzut

quarkus.kubernetes.sidecars.mariadb.image= mariadb:10.5.5
quarkus.kubernetes.sidecars.mariadb.env-vars.MYSQL_DATABASE.name=my
quarkus.kubernetes.sidecars.mariadb.env-vars.MYSQL_ROOT_PASSWORD.name=pass
quarkus.kubernetes.sidecars.mariadb.env-vars.MYSQL_USER.name=root
quarkus.hibernate-orm.database.generation = drop-and-create

  1. Build project
  2. check kuberneties.yaml

Configuration

# Add your application.properties here, if applicable.

Screenshots
(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

  • Output of uname -a or ver:
    uname -a
    Linux my 4.18.0-193.14.3.el8_2.x86_64 Switch to the Maven distributed copy of the SubstrateVM annotations #1 SMP Mon Jul 20 15:02:29 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

  • Output of java -version:
    java -version
    openjdk version "11.0.8" 2020-07-14
    OpenJDK Runtime Environment 18.9 (build 11.0.8+10)
    OpenJDK 64-Bit Server VM 18.9 (build 11.0.8+10, mixed mode)

  • GraalVM version (if different from Java):
    GraalVM and Java the same mandrel-java11-20.1.0.1.Final

  • Quarkus version or git rev:
    <quarkus-plugin.version>1.7.3.Final</quarkus-plugin.version>

  • Build tool (ie. output of mvnw --version or gradlew --version):
    ./mvnw --version  ✔
    Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
    Maven home: /home/aobrzut/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3
    Java version: 11.0.8, vendor: N/A, runtime: /home/aobrzut/tools/graalvm/mandrel/mandrel-java11-20.1.0.1.Final
    Default locale: en_US, platform encoding: UTF-8
    OS name: "linux", version: "4.18.0-193.14.3.el8_2.x86_64", arch: "amd64", family: "unix"

Additional context
based on doc
https://quarkus.io/guides/kubernetes

@arturobrzut arturobrzut added the kind/bug Something isn't working label Sep 13, 2020
@quarkusbot
Copy link

/cc @geoand

@geoand
Copy link
Contributor

geoand commented Sep 14, 2020

@metacosm do you want to take a look at this one?

@metacosm
Copy link
Contributor

Yes, I'll take a look.

@metacosm
Copy link
Contributor

metacosm commented Sep 15, 2020

A first comment: the format of env vars is wrong in your example, @arturobrzut: you need to use quarkus.kubernetes.sidecars.mariadb.env-vars.MYSQL_DATABASE.value=my and not quarkus.kubernetes.sidecars.mariadb.env-vars.MYSQL_DATABASE.name=my and it would actually be nice if Quarkus could warn you / error out when not using the proper syntax instead of silently failing.
That said, even with that change, there is definitely an issue with the code, trying to track it down.

metacosm added a commit to metacosm/quarkus that referenced this issue Sep 15, 2020
Fixes quarkusio#12063. This occurs because the dekorate version of
AddEnvVarDecorator inherits from ApplicationContainerDecorator
which expects metadata to be present, which doesn't happen in our
context. We sidestep the issue by wrapping the original behavior and
calling its andThenVisit method, which does the work when not skipped.
metacosm added a commit to metacosm/quarkus that referenced this issue Sep 15, 2020
Fixes quarkusio#12063. This occurs because the dekorate version of
AddEnvVarDecorator inherits from ApplicationContainerDecorator
which expects metadata to be present, which doesn't happen in our
context. We sidestep the issue by wrapping the original behavior and
calling its andThenVisit method, which does the work when not skipped.
metacosm added a commit to metacosm/quarkus that referenced this issue Sep 16, 2020
Fixes quarkusio#12063. This occurs because the dekorate version of
AddEnvVarDecorator inherits from ApplicationContainerDecorator
which expects metadata to be present, which doesn't happen in our
context. We sidestep the issue by wrapping the original behavior and
calling its andThenVisit method, which does the work when not skipped.
@gsmet gsmet added this to the 1.8.1.Final milestone Sep 17, 2020
gsmet pushed a commit to gsmet/quarkus that referenced this issue Sep 17, 2020
Fixes quarkusio#12063. This occurs because the dekorate version of
AddEnvVarDecorator inherits from ApplicationContainerDecorator
which expects metadata to be present, which doesn't happen in our
context. We sidestep the issue by wrapping the original behavior and
calling its andThenVisit method, which does the work when not skipped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants