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

deployment-target=knative not working with Quarkus 1.9 #12894

Closed
rsvoboda opened this issue Oct 23, 2020 · 7 comments · Fixed by #12906
Closed

deployment-target=knative not working with Quarkus 1.9 #12894

rsvoboda opened this issue Oct 23, 2020 · 7 comments · Fixed by #12906
Assignees
Milestone

Comments

@rsvoboda
Copy link
Member

quarkus.kubernetes.deployment-target=knative not working with Quarkus 1.9, works fine with Quarkus 1.8.2.Final / 1.7.5.Final. Running on OpenShift 4.5 with OpenShift Serverless.

The main message I see in log of the final pod is ERROR Neither $JAVA_MAIN_CLASS nor $JAVA_APP_JAR is set and 0 JARs found in /deployments (1 expected)

The problem I see is that with knative /deployments is still looked at while the path should be /deployments/target

When I switch to quarkus.kubernetes.deployment-target=openshift application starts properly from /deployments/target

reproducer:

oc new-project rsvoboda

rm -rf getting-started
mvn io.quarkus:quarkus-maven-plugin:1.9.0.Final:create \
    -DprojectGroupId=org.acme \
    -DprojectArtifactId=getting-started \
    -DclassName="org.acme.getting.started.GreetingResource" \
    -Dpath="/hello" \
    -Dextensions="openshift, smallrye-health"
cd getting-started

cat > src/main/resources/application.properties <<EOF
quarkus.s2i.base-jvm-image=registry.access.redhat.com/openjdk/openjdk-11-rhel7
quarkus.container-image.registry=image-registry.openshift-image-registry.svc:5000
quarkus.container-image.group=rsvoboda
quarkus.kubernetes.deployment-target=knative
quarkus.kubernetes-client.trust-certs=true
EOF

mvn clean package -Dquarkus.kubernetes.deploy=true -Dquarkus-plugin.version=1.8.2.Final -Dquarkus.platform.version=1.8.2.Final

==> application gets available, e.g. http://getting-started-rsvoboda.apps.ocp45.dynamic.quarkus/hello in my case

mvn clean package -Dquarkus.kubernetes.deploy=true

==> application is not available, CrashLoop Error in console

Error from pod:

Starting the Java application using /opt/jboss/container/java/run/run-java.sh ...
�[0;31mERROR Neither $JAVA_MAIN_CLASS nor $JAVA_APP_JAR is set and 0 JARs found in /deployments (1 expected)�[0m
INFO exec  java -javaagent:/opt/jboss/container/jolokia/jolokia.jar=config=/opt/jboss/container/jolokia/etc/jolokia.properties -XX:+UseParallelOldGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=100m -XX:+ExitOnOutOfMemoryError -cp "." -jar   
Error: -jar requires jar file specification
Usage: java [options] <mainclass> [args...]
           (to execute a class)
  ...

Tried to set quarkus.s2i.jar-directory and quarkus.openshift.jar-directory but it didn't help in my experiments.

@quarkusbot
Copy link

/cc @geoand

@rsvoboda
Copy link
Member Author

@geoand / @iocanel fyi

@geoand
Copy link
Contributor

geoand commented Oct 23, 2020

@iocanel a regression I assume?

@iocanel iocanel self-assigned this Oct 23, 2020
@iocanel
Copy link
Contributor

iocanel commented Oct 23, 2020

For some of build strategies we are using target as the root of the build context. For s2i this pretty means that the artifacts will end up under /deployments/target. This is ok as long as we ensure that the environment variables are aligned. Apparently this is not the case for knative.

I think that we need to do two things here:

  • Ensure that the environment variables are updated everywhere.
  • Only use target for the docker strategy that really needs it.

@iocanel
Copy link
Contributor

iocanel commented Oct 27, 2020

@rsvoboda: I managed to test #12906 against crc + knative and it works fine.

@rsvoboda
Copy link
Member Author

I'm looking at it now :) Finally got working cluster.

@iocanel
Copy link
Contributor

iocanel commented Oct 29, 2020

@rsvoboda: It seems that we need to apply the same fix, for when deployment-target=openshift. (Just pushed it BTW).

This is a regression introduced in: https://github.com/quarkusio/quarkus/pull/12655/files#diff-2f7f8b1e6f4a44f6f156a44d9a60ec9f4a233e7874e8059fb0c627771a505fc4R62

I think we should be fine now.

@gsmet gsmet added this to the 1.10 - master milestone Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants