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

When having Kubernetes extension + other Kubernetes based extensions together outputs lots of warnings during native build #34213

Closed
kjq opened this issue Jun 21, 2023 · 13 comments
Labels
area/kubernetes kind/bug Something isn't working

Comments

@kjq
Copy link

kjq commented Jun 21, 2023

Describe the bug

When introducing the Tekton extension into a Quarkus project the following occurs:

Split package during compile (mvn install):

Detected a split package usage which is considered a bad practice and should be avoided. Following packages were detected in multiple archives:
- "io.fabric8.tekton.triggers.internal.knative.pkg.apis.duck.v1" found in [io.fabric8:tekton-model-triggers-v1alpha1::jar, io.fabric8:tekton-model-triggers-v1beta1::jar]
- "io.fabric8.tekton.triggers.internal.knative.pkg.apis" found in [io.fabric8:tekton-model-triggers-v1alpha1::jar, io.fabric8:tekton-model-triggers-v1beta1::jar]

Unresolved classes during native build (mvn package -Pnative):
This seems to differ depending on the packages included.

When just Tekton is involved it is less but if the Kubernetes extension also happens to be there it is far more (enough to bog down the CI logs).

<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-kubernetes</artifactId>
</dependency>

Just Tekton:

Warning: Could not register io.fabric8.tekton.triggers.v1beta1.EventListenerStatus: allDeclaredConstructors for reflection. Reason: java.lang.NoClassDefFoundError: io/fabric8/tekton/triggers/internal/knative/pkg/apis/duck/v1beta1/Addressable.
Warning: Could not register io.fabric8.tekton.triggers.v1beta1.EventListenerStatus: allDeclaredMethods for reflection. Reason: java.lang.NoClassDefFoundError: io/fabric8/tekton/triggers/internal/knative/pkg/apis/duck/v1beta1/Addressable.
Warning: Could not register io.fabric8.tekton.triggers.v1beta1.EventListenerStatusBuilder: allDeclaredConstructors for reflection. Reason: java.lang.NoClassDefFoundError: io/fabric8/tekton/triggers/internal/knative/pkg/apis/duck/v1beta1/AddressableFluent.
Warning: Could not register io.fabric8.tekton.triggers.v1beta1.EventListenerStatusBuilder: allDeclaredMethods for reflection. Reason: java.lang.NoClassDefFoundError: io/fabric8/tekton/triggers/internal/knative/pkg/apis/duck/v1beta1/AddressableFluent.

With Kubernetes extension:

Warning: Could not register io.fabric8.tekton.triggers.v1beta1.EventListenerStatus: allDeclaredConstructors for reflection. Reason: java.lang.NoClassDefFoundError: io/fabric8/tekton/triggers/internal/knative/pkg/apis/duck/v1beta1/Addressable.
Warning: Could not register io.fabric8.tekton.triggers.v1beta1.EventListenerStatus: allDeclaredMethods for reflection. Reason: java.lang.NoClassDefFoundError: io/fabric8/tekton/triggers/internal/knative/pkg/apis/duck/v1beta1/Addressable.
Warning: Could not register io.fabric8.tekton.triggers.v1beta1.EventListenerStatusBuilder: allDeclaredConstructors for reflection. Reason: java.lang.NoClassDefFoundError: io/fabric8/tekton/triggers/internal/knative/pkg/apis/duck/v1beta1/AddressableFluent.
Warning: Could not register io.fabric8.tekton.triggers.v1beta1.EventListenerStatusBuilder: allDeclaredMethods for reflection. Reason: java.lang.NoClassDefFoundError: io/fabric8/tekton/triggers/internal/knative/pkg/apis/duck/v1beta1/AddressableFluent.
Warning: Could not resolve io.fabric8.openshift.api.model.ImageStreamTagList for reflection configuration. Reason: java.lang.ClassNotFoundException: io.fabric8.openshift.api.model.ImageStreamTagList.
Warning: Could not resolve io.fabric8.openshift.api.model.ProjectList for reflection configuration. Reason: java.lang.ClassNotFoundException: io.fabric8.openshift.api.model.ProjectList.
Warning: Could not resolve io.fabric8.openshift.api.model.NetNamespaceList for reflection configuration. Reason: java.lang.ClassNotFoundException: io.fabric8.openshift.api.model.NetNamespaceList.
Warning: Could not resolve io.fabric8.openshift.api.model.UserList for reflection configuration. Reason: java.lang.ClassNotFoundException: io.fabric8.openshift.api.model.UserList.
Warning: Could not resolve io.fabric8.openshift.api.model.OAuthClientAuthorizationList for reflection configuration. Reason: java.lang.ClassNotFoundException: io.fabric8.openshift.api.model.OAuthClientAuthorizationList.
Warning: Could not resolve io.fabric8.openshift.api.model.LocalSubjectAccessReview for reflection configuration. Reason: java.lang.ClassNotFoundException: io.fabric8.openshift.api.model.LocalSubjectAccessReview.
Warning: Could not resolve io.fabric8.openshift.api.model.RangeAllocation for reflection configuration. Reason: java.lang.ClassNotFoundException: io.fabric8.openshift.api.model.RangeAllocation.
Warning: Could not resolve io.fabric8.openshift.api.model.User for reflection configuration. Reason: java.lang.ClassNotFoundException: io.fabric8.openshift.api.model.User.
Warning: Could not resolve io.fabric8.openshift.api.model.TemplateInstanceList for reflection configuration. Reason: java.lang.ClassNotFoundException: io.fabric8.openshift.api.model.TemplateInstanceList.
...

Expected behavior

Native builds produce minimal or no warnings or the warnings can somehow be filtered out.

Actual behavior

So many warnings it makes it hard to review the CI logs.

How to Reproduce?

Reproduce the error:

  1. Run mvn package -Pnative

Not display all the warnings:

  1. Remove the kubernetes dependency from the POM
  2. run mvn package -Pnative

Output of uname -a or ver

No response

Output of java -version

17

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

Maven 3.9

Additional information

This has not (or does not yet) seem to affect anything functionally.

@kjq kjq added the kind/bug Something isn't working label Jun 21, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Jun 21, 2023

/cc @Sgitario (kubernetes), @geoand (knative,kubernetes,openshift), @iocanel (knative,kubernetes,openshift)

@kjq
Copy link
Author

kjq commented Jun 21, 2023

Attached is a reproducer:

reproducer.zip

@kjq
Copy link
Author

kjq commented Jun 21, 2023

As an FYI, if i remove the direct dependency on the quarkus-kubernetes extension the quarkus-helm extension still will pull it in.

@Sgitario
Copy link
Contributor

I think this issue got fixed using Fabric8 Kubernetes Client 6.7.2 (unless I can't see it anymore using Quarkus 999-SNAPSHOT):

Warning: Could not register io.fabric8.tekton.triggers.v1beta1.EventListenerStatus: allDeclaredConstructors for reflection. Reason: java.lang.NoClassDefFoundError: io/fabric8/tekton/triggers/internal/knative/pkg/apis/duck/v1beta1/Addressable.
Warning: Could not register io.fabric8.tekton.triggers.v1beta1.EventListenerStatus: allDeclaredMethods for reflection. Reason: java.lang.NoClassDefFoundError: io/fabric8/tekton/triggers/internal/knative/pkg/apis/duck/v1beta1/Addressable.
Warning: Could not register io.fabric8.tekton.triggers.v1beta1.EventListenerStatusBuilder: allDeclaredConstructors for reflection. Reason: java.lang.NoClassDefFoundError: io/fabric8/tekton/triggers/internal/knative/pkg/apis/duck/v1beta1/AddressableFluent.
Warning: Could not register io.fabric8.tekton.triggers.v1beta1.EventListenerStatusBuilder: allDeclaredMethods for reflection. Reason: java.lang.NoClassDefFoundError: io/fabric8/tekton/triggers/internal/knative/pkg/apis/duck/v1beta1/AddressableFluent.

About the rest of the warnings, I guess this is triggered by the Quarkus Kubernetes Client extension plus the Quarkus Tekton extension in the classpath: for some reason, the Quarkus Kubernetes Client extension tries to register those classes for reflection and they do not exist, but I could not see why it tries to register these classes, maybe @geoand can see it.

@geoand
Copy link
Contributor

geoand commented Jun 22, 2023

the Quarkus Kubernetes Client extension tries to register those classes for reflection and they do not exist, but I could not see why it tries to register these classes, maybe @geoand can see it

The only way would be to debug the build-time code that performs the reflection registration

@Sgitario Sgitario changed the title Tekton and Kubernetes extension together outputs lots of warnings during native build When having Kubernetes extension + other Kubernetes based extensions together outputs lots of warnings during native build Jul 6, 2023
@Sgitario
Copy link
Contributor

Sgitario commented Jul 6, 2023

Title updated since this's also happening when having the Kubernetes Config extension.
cc @manusa @metacosm

@manusa
Copy link
Contributor

manusa commented Jul 6, 2023

Yes the Client should be registering any of the KubernetesResource classes that are detected (I'm assuming this is at the Jandex level and not with the changes introduced by #33767)

Collection<ClassInfo> kubernetesResourceImpls = combinedIndexBuildItem.getIndex()

What I find weird is that these classes are not found.

@erik-wramner
Copy link

I'm also getting tons of warnings for missing classes in packages io.fabric8.openshift and io.fabric8.knative. I'm pulling in quarkus-kubernetes-config and quarkus-kubernetes, but nothing from openshift or knative AFAIK. These warnings were not present in Quarkus 2, the came with the upgrade to 3 just now.

As long as it is only build time warnings it is not critical, but I don't like it. Perhaps they point to something that is wrong.

@gsmet
Copy link
Member

gsmet commented Aug 3, 2023

@manusa did we make progress on this issue? We had another report today and, while not critical, it's not really pretty and people are asking about it.

@manusa
Copy link
Contributor

manusa commented Aug 3, 2023

The split package issue was addressed by fabric8io/kubernetes-client#5113 (Is available on 6.8.0 - needs #34956)

The other issues might have been solved too, but would need to properly check once we bump the Kubernetes Client dependency version (fabric8io/kubernetes-client#5345)

@edeandrea
Copy link
Contributor

edeandrea commented Nov 29, 2023

Adding onto this thread. I've started seeing this in the Quarkus superheroes sample application with the upgrade from 3.5.3 -> 3.6.0. I had not seen this before 3.5.3. Also, it's only happening in 1 of the apps (rest-fights).

All of the apps use multiple kubernetes extensions (kubernetes, openshift, minikube, knative).

See https://github.com/quarkusio/quarkus-super-heroes/actions/runs/7033441570/job/19139277699#step:6:5502 for the full log.

All the apps in the superheroes sample are different apps. Most expose a rest interface. The one in question uses mongodb (with liquibase) & smallrye stork, which is different from any of the other apps. Smallrye Stork in turn uses the kubernetes client.

This app also uses reactive messaging kafka, avro, & apicurio, but so does one of the other apps that does not seem to have this problem.

@edeandrea
Copy link
Contributor

edeandrea commented Nov 29, 2023

This seems to be an issue with the quarkus-kubernetes-client extension. If I add that extension to a different project I then start to see this issue.

What's interesting, though, is if I build with Java 21/GraalVM CE 21, I do not see the issue. Only with Java 17/GraalVM CE 17.

@gsmet
Copy link
Member

gsmet commented Oct 2, 2024

From what I can see with the latest versions, the issue initially mentioned here has been fixed.

@gsmet gsmet closed this as completed Oct 2, 2024
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

No branches or pull requests

7 participants