Skip to content

V1Status not support k8s latest version: 1.18 #969

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

Closed
github-edu opened this issue Jun 3, 2020 · 5 comments
Closed

V1Status not support k8s latest version: 1.18 #969

github-edu opened this issue Jun 3, 2020 · 5 comments

Comments

@github-edu
Copy link

JSON filed status is Object, not String

{
  "kind": "Namespace",
  "apiVersion": "v1",
  "metadata": {
    "name": "created-by-java-1591085118384",
    "selfLink": "/api/v1/namespaces/created-by-java-1591085118384",
    "uid": "5d5cc84d-339d-4e0c-86e5-d287601e928a",
    "resourceVersion": "70213",
    "creationTimestamp": "2020-06-02T08:06:11Z",
    "deletionTimestamp": "2020-06-02T08:07:19Z",
    "managedFields": [
      {
        "manager": "OpenAPI-Generator",
        "operation": "Update",
        "apiVersion": "v1",
        "time": "2020-06-02T08:06:11Z",
        "fieldsType": "FieldsV1",
        "fieldsV1": {"f:status":{"f:phase":{}}}
      }
    ]
  },
  "spec": {
    "finalizers": [
      "kubernetes"
    ]
  },
  "status": {
    "phase": "Terminating"
  }
}
@github-edu
Copy link
Author

github-edu commented Jun 3, 2020

...


/**
 * Status is a return value for calls that don't return other objects.
 */
@ApiModel(description = "Status is a return value for calls that don't return other objects.")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2020-04-29T07:27:12.312Z[Etc/UTC]")
public class V1Status {

  public static final String SERIALIZED_NAME_STATUS = "status";
  @SerializedName(SERIALIZED_NAME_STATUS)
  private String status;

...

@github-edu
Copy link
Author

github-edu commented Jun 3, 2020

Cause: JSON deserialization failed

// Exp.
CoreV1Api api = new CoreV1Api();
V1Status status = api.deleteNamespace(nsName,  ...
  • Error Stack
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 30 column 14 path $.status
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)
	at com.google.gson.Gson.fromJson(Gson.java:887)
	at com.google.gson.Gson.fromJson(Gson.java:852)
	at com.google.gson.Gson.fromJson(Gson.java:801)
	at io.kubernetes.client.openapi.JSON.deserialize(JSON.java:139)
	at io.kubernetes.client.openapi.ApiClient.deserialize(ApiClient.java:765)
	at io.kubernetes.client.openapi.ApiClient.handleResponse(ApiClient.java:968)
	at io.kubernetes.client.openapi.ApiClient.execute(ApiClient.java:895)
	at io.kubernetes.client.openapi.apis.CoreV1Api.deleteNamespaceWithHttpInfo(CoreV1Api.java:12669)
	at io.kubernetes.client.openapi.apis.CoreV1Api.deleteNamespace(CoreV1Api.java:12642)
	at com.primeton.caas.k8s.CreateNamespaceTest.main(CreateNamespaceTest.java:39)
Caused by: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 30 column 14 path $.status
	at com.google.gson.stream.JsonReader.nextString(JsonReader.java:825)
	at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:418)
	at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:406)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
	... 10 more

@github-edu
Copy link
Author

Although the client fails to get the JSON deserialization result of the call, it does not affect the successful execution of the k8s server.

@yue9944882
Copy link
Member

@brendandburns
Copy link
Contributor

Closing this since it is a duplicate of #86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants