kubernetes-client/java

listNode api error

Closed this issue · 2 comments

I use the next code to test listNode() api:

CoreV1Api api = new CoreV1Api(client);
V1NodeList execute = api.listNode().execute();

response error:
Exception in thread "main" java.lang.IllegalArgumentException: Expected the field names to be an array in the JSON string but got null

I debug find the function JSON.deserialize(respBody, returnType) thnow the error,

Client Version 20.0.0
Kubernetes = 1.28.10
java = 17

This is a duplicate of #3076

tl;dr; there is a difference between the swagger schema and the Go JSON library in terms of how it treats empty arrays.

For now you can use the legacy version to work around this. We can consider if we want to fix this in the upstream code generator, but honestly, I think this is a bug in the Kubernetes API server.