-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
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?