-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
kubernetesClient.resources(HasMetadata.class).inNamespace("default").withLabels(Map.of("foo", "bar").list() throws NullPointerException #3990
Comments
This is not currently expected to work, but it should throw a better exception. There's currently no facility for scanning all resources in a given namespace. See the workaround and the issue in general #887 (comment) |
This issue should be closed after we implement a fix that logs a better message. In any case, it shouldn't be supported a |
I can reproduce this issue on v5.12.2 However, on the master branch( May 10, 2022 2:37:36 PM okhttp3.mockwebserver.MockWebServer$2 execute
INFO: MockWebServer[42711] starting to accept connections
May 10, 2022 2:37:36 PM okhttp3.mockwebserver.MockWebServer$2 execute
INFO: MockWebServer[54931] starting to accept connections
May 10, 2022 2:37:36 PM okhttp3.mockwebserver.MockWebServer$3 processOneRequest
INFO: MockWebServer[54931] received request: GET /api/v1/hasmetadatas?labelSelector=foo%3Dbar HTTP/1.1 and responded: HTTP/1.1 404 Client Error
May 10, 2022 2:37:36 PM okhttp3.mockwebserver.MockWebServer$2 acceptConnections
INFO: MockWebServer[54931] done accepting connections: Socket closed
io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://localhost:54931/api/v1/hasmetadatas?labelSelector=foo%3Dbar. Message: Not Found.
at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.requestFailure(OperationSupport.java:735)
at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.requestFailure(OperationSupport.java:713)
at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.assertResponseCode(OperationSupport.java:664)
at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.lambda$handleResponse$0(OperationSupport.java:580)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2073)
at io.fabric8.kubernetes.client.okhttp.OkHttpClientImpl$4.onResponse(OkHttpClientImpl.java:263)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:203)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Process finished with exit code 255 |
…in `resources(...)` API (fabric8io#3990) Access to `resources(...)` DSL method with generic HasMetadata interface shouldn't be allowed. Signed-off-by: Rohan Kumar <[email protected]>
…in `resources(...)` API (fabric8io#3990) Access to `resources(...)` DSL method with generic HasMetadata interface shouldn't be allowed. Signed-off-by: Rohan Kumar <[email protected]>
…in `resources(...)` API (fabric8io#3990) Access to `resources(...)` DSL method with generic HasMetadata interface shouldn't be allowed. Signed-off-by: Rohan Kumar <[email protected]>
…in `resources(...)` API (fabric8io#3990) Access to `resources(...)` DSL method with generic HasMetadata interface shouldn't be allowed. Signed-off-by: Rohan Kumar <[email protected]>
…in `resources(...)` API (#3990) Access to `resources(...)` DSL method with generic HasMetadata interface shouldn't be allowed. Signed-off-by: Rohan Kumar <[email protected]>
#Hi @rohanKanojia @manusa @shawkins @thiagoarrais , I'm getting below exception, when we try to watch Openshift resource using the provided code. Exception :: Caused by: java.lang.IllegalArgumentException: resources cannot be called with an interface CODE::
Maven dep ::
Is there anyway to watch all resources in single watcher, we tried to use Event, but that doesn't has all metadata of resource. Thank you in advance :) |
No, it's not possible. The Kubernetes API doesn't offer such feature. |
Describe the bug
When trying to obtain a list of any resource matching a certain set of labels, a NullPointerException is thrown.
The NPE is thrown here io.fabric8.kubernetes.client.dsl.base.OperationSupport#getRootUrl:
apiGroupVersion
is null at this point.I'm sure I'm invoking the API incorrectly, but I couldn't find how to do this in a different way.
I'm using the operator, and I think it's pulling in the client version 5.12, but I can't select that below.
Fabric8 Kubernetes Client version
5.10.0
Steps to reproduce
Run Java code as shown above and observe the NPE.
Expected behavior
A list of resources is returned.
Runtime
other (please specify in additional context)
Kubernetes API Server version
1.22.3@latest
Environment
macOS
Fabric8 Kubernetes Client Logs
No response
Additional context
v1.22.6+k3s1 (k3d)
The text was updated successfully, but these errors were encountered: