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 extension does not register CustomResources from dependent packages #38657

Closed
Javatar81 opened this issue Feb 7, 2024 · 5 comments

Comments

@Javatar81
Copy link

Describe the bug

Error in native executable when CustomResource is not registered for reflection.

cannot deserialize from Object value (no delegate- or property-based Creator): this appears to be a native image, in which case you may need to configure reflection for the class that is to be deserialized

Expected behavior

CustomResources should be registered for reflection although they are part of an external dependency.

Actual behavior

CustomResources are not registered for reflection if they are part of an external dependency. You have to add @RegisterForReflection

How to Reproduce?

  1. Create a new Quarkus project A using the kubernetes extension and optionally the quarkus-operator-sdk extension
  2. Create another maven project B.
  3. Create a class in project B that extends io.fabric8.kubernetes.client.CustomResource.
  4. Add B as a dependency to the Quarkus project A.
  5. Index B by setting quarkus.index-dependency.model.group-id and quarkus.index-dependency.model.artifact-id to point to project
  6. Build project B.
  7. Build project A with -Pnative
  8. If you try to deserialize a CustomResource, e.g. as part of an operator, you will get the error described above

Output of uname -a or ver

OpenShift

Output of java -version

17

Mandrel or GraalVM version (if different from Java)

quay.io/quarkus/ubi-quarkus-mandrel-builder-image:23.0-jdk-17

Quarkus version or git rev

3.7.1

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

Apache Maven 3.8.6

Additional information

No response

@Javatar81 Javatar81 added area/native-image kind/bug Something isn't working labels Feb 7, 2024
Copy link

quarkus-bot bot commented Feb 7, 2024

/cc @Karm (mandrel), @galderz (mandrel), @geoand (kubernetes,openshift), @iocanel (kubernetes,openshift), @zakkak (mandrel)

@geoand
Copy link
Contributor

geoand commented Feb 7, 2024

I assume that the Java Operator SDK extension handles this, right @metacosm?

@metacosm
Copy link
Contributor

metacosm commented Feb 7, 2024

Actually, this is what #38586 is supposed to fix.

@Javatar81
Copy link
Author

I found that this is already solved by this PR: #38586.

@geoand
Copy link
Contributor

geoand commented Feb 7, 2024

Gotcha, thanks

metacosm added a commit to quarkiverse/quarkus-operator-sdk that referenced this issue Feb 8, 2024
Fixes #824
Previously, we were only registering the class itself for reflection, we
now register the full hierarchy instead.

Signed-off-by: Chris Laprun <claprun@redhat.com>
metacosm added a commit to quarkiverse/quarkus-operator-sdk that referenced this issue Feb 8, 2024
Fixes #824
Previously, we were only registering the class itself for reflection, we
now register the full hierarchy instead.

Signed-off-by: Chris Laprun <claprun@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants