java icon indicating copy to clipboard operation
java copied to clipboard

coreApi.readNode() method exception has no details

Open guruguha opened this issue 2 years ago • 6 comments
trafficstars

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.

guruguha avatar Nov 08 '23 23:11 guruguha

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

Screenshot 2023-11-10 101825

Ananya2001-an avatar Nov 10 '23 04:11 Ananya2001-an

@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.

guruguha avatar Nov 10 '23 17:11 guruguha

Also, the issue is that there is no exception message which makes this very cryptic and not at all helpful for debugging.

guruguha avatar Nov 10 '23 17:11 guruguha

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.

brendandburns avatar Nov 10 '23 18:11 brendandburns

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

k8s-triage-robot avatar Feb 08 '24 19:02 k8s-triage-robot

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

k8s-triage-robot avatar Mar 09 '24 19:03 k8s-triage-robot

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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 avatar Apr 08 '24 20:04 k8s-triage-robot

@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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

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.

k8s-ci-robot avatar Apr 08 '24 20:04 k8s-ci-robot