Home > Back-end >  Quarkus K8S operator - NoSuchField execption when runnin tests
Quarkus K8S operator - NoSuchField execption when runnin tests

Time:11-03

When I run my tests for my K8S operator using quarkus operator, I get the following stack trace:

2021-10-29 18:14:08,668 WARN  [io.qua.ope.dep.OperatorSDKProcessor] (build-33) Use of deprecated check-crd-and-validate-local-model property. Use crd.validate instead.

java.lang.RuntimeException: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
    [error]: Build step io.quarkiverse.operatorsdk.deployment.OperatorSDKProcessor#createConfigurationServiceAndOperator threw an exception: java.lang.NoSuchFieldError: _visitables
    at io.sundr.model.ClassRefFluentImpl.withArguments(ClassRefFluentImpl.java:318)
    at io.sundr.adapter.reflect.TypeToTypeRef.apply(TypeToTypeRef.java:114)
    at io.sundr.adapter.reflect.TypeToTypeRef.apply(TypeToTypeRef.java:76)
    at io.sundr.adapter.reflect.TypeToTypeRef.apply(TypeToTypeRef.java:41)
    at io.sundr.adapter.reflect.ClassToTypeDef.apply(ClassToTypeDef.java:92)
    at io.sundr.adapter.reflect.ClassToTypeDef.apply(ClassToTypeDef.java:55)
    at io.sundr.adapter.api.Adapter.adaptType(Adapter.java:38)
    at io.sundr.adapter.api.Adapters.lambda$adaptType$0(Adapters.java:35)
    at java.base/java.util.Optional.map(Optional.java:265)
    at io.sundr.adapter.api.Adapters.adaptType(Adapters.java:35)
    at io.fabric8.crd.generator.utils.Types.typeDefFrom(Types.java:53)
    at io.fabric8.crd.generator.CustomResourceInfo.fromClass(CustomResourceInfo.java:137)
    at io.quarkiverse.operatorsdk.deployment.OperatorSDKProcessor.createControllerConfiguration(OperatorSDKProcessor.java:281)
    at io.quarkiverse.operatorsdk.deployment.OperatorSDKProcessor.lambda$createConfigurationServiceAndOperator$0(OperatorSDKProcessor.java:133)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
    at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1603)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
    at io.quarkiverse.operatorsdk.deployment.OperatorSDKProcessor.createConfigurationServiceAndOperator(OperatorSDKProcessor.java:137)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
    at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
    at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
    at java.base/java.lang.Thread.run(Thread.java:829)
    at org.jboss.threads.JBossThread.run(JBossThread.java:501)
...

I really do not know where to look to solve this.

When I run the operator as a standalone, it works normally, the issue is only when running tests.

CodePudding user response:

It looks like you're using a version of the fabric8 client that is too old. You're using fabric8 5.3.0 while the quarkus-operator-sdk version 1.9.4 uses fabric8 5.4.0. Using the same fabric8 client version should solve your issue.

CodePudding user response:

The issue was coming from my maven version: I was using the mvn bundled with my IDE in v3.6.3 instead of the one I use in the whole system v3.8.1.

The very weird thing here is that I had the same error while runing mvn clean install from a terminal (so using the v3.8.1 version)

Anyway, it works now.

  • Related