Skip to content

Improved documentation for watching custom resources #2240

@jmcrawford45

Description

@jmcrawford45

I've been trying for a few hours to figure out what the expected workflow is for watching custom objects. Basically, I want to setup something in scala similar to https://www.baeldung.com/java-kubernetes-watch for custom objects. I followed https://github.com/kubernetes-client/java/wiki/5.-Generate-Java-CRD-Model for generating custom resource classes. I was able to get a resource version by applying a hack I saw in another github issue
val tsdList = { clients.head.listClusterCustomObjectCall( ... ) } val response = tsdList.execute() if (response.isSuccessful) { val body = response.body().string() gson .fromJson(body, classOf[CustomResourceList]).getMetadata.getResourceVersion } else null

But, when I try to watch the resource, I get a response with everything (status, type, object) set to null and no clear indicator of what's happening.

val call = clients.head.listClusterCustomObjectCall( ... resourceVersion, if (resourceVersion != null) "NotOlderThan" else null, ... ) val watch: Watch[Object] = Watch.createWatch( clients.head.getApiClient, call, new TypeToken[Response[Object]]() {}.getType)

Is there some other way that custom resources are expected to be handled?

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions