-
Notifications
You must be signed in to change notification settings - Fork 50
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 Operator SDK 6.1.1 breaks operator.start() in QuarkusTests #659
Comments
Hi @Donnerbart , AFAIK the Kubernetes Mock Server does not implement server side apply. |
To my understanding Would #660 be a correct fix then? I would just need to figure out how to configure |
It's at least a "works on my machine" 😅 10:05:44.702 [Test worker] INFO i.q.o.runtime.OperatorProducer - Quarkus Java Operator SDK extension 6.2.2-SNAPSHOT
(commit: d73e005 on branch: bugfix/659-fix-crdutils-apply) built on Tue Jul 18 10:02:49 CEST 2023
Jul 18, 2023 10:05:44 AM okhttp3.mockwebserver.MockWebServer$3 processOneRequest
INFO: MockWebServer[49695] received request: GET
/apis/apiextensions.k8s.io/v1/customresourcedefinitions/test-resources.donnerbart.de
HTTP/1.1 and responded: HTTP/1.1 404 Client Error
Jul 18, 2023 10:05:44 AM okhttp3.mockwebserver.MockWebServer$3 processOneRequest
INFO: MockWebServer[49695] received request: POST
/apis/apiextensions.k8s.io/v1/customresourcedefinitions
HTTP/1.1 and responded: HTTP/1.1 201 OK
10:05:44.917 [Test worker] INFO i.q.operatorsdk.runtime.CRDUtils - Applied v1 CRD named
'test-resources.donnerbart.de' from
/home/donnerbart/IdeaProjects/operator-test/build/kubernetes/test-resources.donnerbart.de-v1.yml using this Gradle configuration
|
Ideally, the mock server shouldn't be used anymore with Quarkus and replaced by using the Kubernetes Dev Services since this will bring up a full cluster instead of an incomplete and possibly flawed mock version of the Kubernetes API. |
We already have a working setup with a (modified) K3sContainer for our integration tests. The use case for the mock server is primarily code coverage with a quick unit testsuite. I'll look into the Dev Services, but if the lifecycle takes too much time to setup/teardown or if we have to refactor a lot to isolate unit tests when a shared cluster is used, we would still be blocked to update from Quarkus 6.1.0 :( |
It does not in crud mode, and likely never will. You can of course add specific expectations if needed. |
Hey folks, when updating the Quarkus Operator SDK to 6.1.1 or newer, we cannot start an injected operator in a
@QuarkusTest
anymore.Expected Behavior
The CRD can be applied and the operator is started (works with 6.1.0 or older).
Actual Behavior
The CRD cannot be applied and the operator cannot be started (fails with 6.1.1 or newer).
Root Cause
The root cause seems to be this change in
CRDUtils.apply()
from:to
Reproducer
When we switched our operator to Quarkus 3 and fixed the K8s client deprecations in our codebase, the
serverSideApply()
method didn't work out for us (at least not with the Kubernetes Mock Server in unit tests). We replaced everything with eithercreate()
orupdate()
when the state/existence of a resource is known, or aget()
and then eitherupdate()
orcreate()
when the state/existence of a resource is unknown.Are we using the framework in a wrong way or is there a problem with
serverSideApply()
in unit tests?The text was updated successfully, but these errors were encountered: