java
java copied to clipboard
coreApi.readNode() method exception has no details
Describe the bug
When using the Java client API to fetch node details, the API throws a runtime exception and doesn't provide any details as to why the exception happened. i.e., return value from ex.getMessage() is empty.
The only stack trace print is:
io.kubernetes.client.openapi.ApiException:
at io.kubernetes.client.openapi.ApiClient.handleResponse(ApiClient.java:973) ~[blob_p-3cd72cadcfba546d41cd13cdb234a4f19801cc6c-384eac9721a9464143f65d3b9a7c59fa:2.1.2]
at io.kubernetes.client.openapi.ApiClient.execute(ApiClient.java:885) ~[blob_p-3cd72cadcfba546d41cd13cdb234a4f19801cc6c-384eac9721a9464143f65d3b9a7c59fa:2.1.2]
at io.kubernetes.client.openapi.apis.CoreV1Api.readNodeWithHttpInfo(CoreV1Api.java:53351) ~[blob_p-3cd72cadcfba546d41cd13cdb234a4f19801cc6c-384eac9721a9464143f65d3b9a7c59fa:2.1.2]
at io.kubernetes.client.openapi.apis.CoreV1Api.readNode(CoreV1Api.java:53329) ~[blob_p-3cd72cadcfba546d41cd13cdb234a4f19801cc6c-384eac9721a9464143f65d3b9a7c59fa:2.1.2]
Client Version
18.0.1
Kubernetes Version
1.23
Java Version Java 8
To Reproduce Steps to reproduce the behavior: Try to fetch the AZ details of a specific node using the K8S API given the namespace and pod name:
ApiClient client = Config.defaultClient();
Configuration.setDefaultApiClient(client);
String podName = System.getenv("POD_NAME");
String namespace = System.getenv("POD_NAMESPACE");
CoreV1Api coreApi = new CoreV1Api();
V1Pod pod = coreApi.readNamespacedPod(podName, namespace, null);
String nodeName = pod.getSpec().getNodeName();
V1Node node = coreApi.readNode(nodeName, null);
V1ObjectMeta metadata = node.getMetadata();
Map<String, String> labels = metadata.getLabels();
Expected behavior It should clearly show what the error is.
KubeConfig If applicable, add a KubeConfig file with secrets redacted.
Server (please complete the following information):
- OS: Linux
- Environment : EKS
- Cloud : AWS
Additional context Add any other context about the problem here.
Hey @guruguha the code seems to be running fine on my side. I am able to retrieve the labels at the end...I am not sure what's wrong with the readNode() method here... I am testing with the minikube cluster here
@Ananya2001-an thanks for checking. I am running this on my Flink cluster. Current behavior is that it works and fetches the node labels correctly for Flink running with Spotify operator. It fails to fetch the node labels when running Flink with Apache operator. The cluster definition is the same and there is no difference in how I'm setting up the cluster.
Also, the issue is that there is no exception message which makes this very cryptic and not at all helpful for debugging.
Have a look at the discussion here: https://github.com/kubernetes-client/java/issues/2066
There are several ways to get additional information from the ApiException.
Ultimately someone needs to make a fix in the upstream code generator.
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle stale - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle rotten - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Reopen this issue with
/reopen - Mark this issue as fresh with
/remove-lifecycle rotten - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied- After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied- After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closedYou can:
- Reopen this issue with
/reopen- Mark this issue as fresh with
/remove-lifecycle rotten- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.