Skip to content

JSON deserialization problem when watch V1Pod events with bookmark enabled.Β #4160

@dongxinEric

Description

@dongxinEric

Describe the bug
We encountered the same problem first reported here: deserialization exception was thrown when iterating the Watchable<V1Pod> because the bookmark events do not have fully constructed V1Pod object in the payload.

Client Version
24.0.0

Kubernetes Version
1.33.2-gke.1111000

Java Version
Java 24

To Reproduce
Steps to reproduce the behavior:

(borrowing from first report of the bug)

try (Watch<V1Pod> watch = Watch.createWatch(client, api.listNamespacedPod("namespace")
        .timeoutSeconds(60)
        .watch(true)
        .allowWatchBookmarks(true)
        .resourceVersion(currentVersion)
        .buildCall(null), (new TypeToken<Watch.Response<V1Pod>>() {
}).getType())) {
    for (Watch.Response<V1Pod> response : watch) {
        //do something with the response
    }
}

Expected behavior
Iterating through the response should not throw the following deserialization exception

java.lang.IllegalArgumentException: Expected the field `containers` to be an array in the JSON string but got `null`
	at io.kubernetes.client.openapi.models.V1PodSpec.validateJsonObject(V1PodSpec.java:1354)
	at io.kubernetes.client.openapi.models.V1Pod.validateJsonObject(V1Pod.java:280)
	at io.kubernetes.client.openapi.models.V1Pod$CustomTypeAdapterFactory$1.read(V1Pod.java:309)
	at io.kubernetes.client.openapi.models.V1Pod$CustomTypeAdapterFactory$1.read(V1Pod.java:299)
...

KubeConfig
N/A

Server (please complete the following information):

  • OS: RockyLinux
  • Environment: Docker
  • Cloud: GCP

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions