quarkus
quarkus copied to clipboard
App won't start in OpenShift due to incorrect JAVA_APP_JAR with quarkus-kubernetes-config
Describe the bug
Quarkus app won't start in OpenShift as there is JAVA_APP_JAR set to ~ artifact-id-version-runner.jar and no CMD set. In Quarkus 2.12.2.Final there was also set /deployments/artifact-id-version-runner.jar (so not a new behavior), however that was not used as there was cmd that started the app
Command:
java
-jar
/deployments/quarkus-run.jar
It's consequence of https://github.com/quarkusio/quarkus/pull/27733, differs from https://github.com/quarkusio/quarkus/issues/28037 in that I added single dependency quarkus-kubernetes-config.
Expected behavior
App should start just fine, e.g. it could set JAVA_APP_JAR to /deployments/quarkus-run.jar or set cmd.
Example of generated openshift.yml with reproducer when k8 config dep is removed: https://github.com/michalvavrik/openshift-quickstart/blob/master/without-troublesome-dep-openshift.yml
Actual behavior
Example of generated openshift.yml with reproducer: https://github.com/michalvavrik/openshift-quickstart/blob/master/troublesome-openshift.yml
App POD in CrashLoopBackOff and exception is logged:
Starting the Java application using /opt/jboss/container/java/run/run-java.sh ...
ERROR No such file /deployments/openshift-quickstart-1.0.0-SNAPSHOT-runner.jar
INFO exec java -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:+ExitOnOutOfMemoryError -cp "." -jar
Error: -jar requires jar file specification
Usage: java [options] <mainclass> [args...]
...
How to Reproduce?
Reproducer:
Prerequisity:
- OC stuff
Steps to reproduce the behavior:
git clone https://github.com/michalvavrik/openshift-quickstart.gitcd openshift-quickstartquarkus build- inspect pod
Alternative reproducer: Quarkus QE test suite module contains failing test, clone it, and run mvn clean verify -f config/ -Dit.test=OpenShiftApiServerConfigSecretConfigIT -Dopenshift
Output of uname -a or ver
Linux fedora 5.19.6-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 31 17:58:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Output of java -version
openjdk version "17.0.3" 2022-04-19
GraalVM version (if different from Java)
GraalVM CE 22.1.0
Quarkus version or git rev
999-SNAPSHOT & 2.13.0.CR1
Build tool (ie. output of mvnw --version or gradlew --version)
Apache Maven 3.8.6
Additional information
I think JAVA_APP_JAR that is set through AddEnvVarDecorator is overwritten in Dekorate (just suggestion...).
/cc @Sgitario, @geoand, @iocanel
Isn't this similar to one you had reported a few days ago?
@geoand very similar, but that one is fixed. This one, I believe, is due to Dekorate overwriting the env. variable JAVA_APP_JAR. This is not a new behavior as this issue was already in Quarkus 2.12 etc. it's just now we don't have a CMD se the variable is actually used.
Please mention that the issue I opened a few days ago is fixed and arguably in desirable fashion. Had Dekorate respected the variable we set in Quarkus, it would also fix this one - but that's my opinion, please ask @Sgitario and @iocanel .
I didn't know about this scenario, that's why I created new issue now.
Makes sense, I just wanted to clarify.