quarkiverse / quarkus-operator-sdk

Quarkus Extension to create Kubernetes Operators in Java using the Java Operator SDK (https://github.com/java-operator-sdk/java-operator-sdk) project
Apache License 2.0
116 stars 50 forks source link

Quarkus Test Kubernetes Client is incompatible with quarkus-operator-sdk. #645

Open hmadison opened 1 year ago

hmadison commented 1 year ago

When using version 6.2.0 of the quarkus-operator-sdk, the quarkus-test-kubernetes-client library no longer is able to act as a mock for the Kuberntes API server. To the best of my understanding, the switch to server side apply in version 4.4.0 of the java-operator-sdk is the source of the issue. The test client library does not appear to be able to emulate the server side apply behaviors necessary to let the operator sdk function.

A possible workaround is to set quarkus.kubernetes-client.devservices.enabled=false in your test application.properties file and use either jenvtest or Testcontainer's k3s support to validate the behavior of your operator.

metacosm commented 1 year ago

I think you mean set the property to true so that devservices are enabled and use this instead of the mock server. This is what the extension is actually doing (testing against a cluster brought up via Quarkus' Kubernetes devservice).

Personally speaking, I think that the mock server should eventually disappear as it's difficult to maintain and more or less would need to tend to a full re-implementation of the kubernetes APIs which is a losing proposition.