CustomObjectsApi.getNamespacedCustomObject does not return metadata in the latest version of the client
Closed this issue · 8 comments
Describe the bug
We use CustomObjectsApi
to deal with the CRUD operations for istio related resources. Since upgrading the k8s client version to 20.0.1, the CustomObjectsApi.getNamespacedCustomObject
does not return metadata
as part of the response. This used to work in the older version of the client 1.12
.
Client Version
20.0.1
Kubernetes Version
1.29
Java Version
Java 21
To Reproduce
Steps to reproduce the behavior:
public class CustomObjectResourceVersion {
public static void main(String[] args) {
try {
ApiClient client = Config.defaultClient();
io.kubernetes.client.openapi.Configuration.setDefaultApiClient(client);
CustomObjectsApi customObjectsApi = new CustomObjectsApi(client);
String group = "networking.istio.io";
String version = "v1beta1";
String namespace = "default";
String plural = "virtualservices";
String name = "vs-name";
Map<String, Object> customObject = (Map<String, Object>) customObjectsApi.getNamespacedCustomObject(
group,
version,
namespace,
plural,
name
);
Gson gson = new Gson();
String vsJsonString = gson.toJson(customObject);
VirtualService existingVirtualService = gson.fromJson(vsJsonString, VirtualService.class);
String resourceVersion = existingVirtualService.getMetadata().getResourceVersion();
} catch(Exception e) {
e.printStackTrace();
}
}
Expected behavior
It should return the metadata.
Output of raw JSON
{\\\"group\\\":\\\"networking.istio.io\\\",\\\"version\\\":\\\"v1beta1\\\",\\\"namespace\\\":\\\"namespace-name\\\",\\\"plural\\\":\\\"virtualservices\\\",\\\"name\\\":\\\"example-virtualservice-name\\\"} \"}
Can you print the raw JSON object and attach it to this issue?
Additionally, can you try the 20.0.1-legacy
version and see if that works?
@brendandburns updated the issue description with the raw json object. I can also confirm that this works without any problem with 20.0.1-legacy
For the raw JSON, I was hoping for the JSON that came back from the API server, not the JSON output of the client side object.
Can you provide the JSON from the server so that we can determine if there is some sort of parsing error?
For context, the code generator changed in the 20 release, which is likely the difference causing this, but I'm not certain exactly what is going wrong.
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
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
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: 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 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-sigs/prow repository.