I'm working with Kubernetes java library fabric8
and I'm able to react in my code when new Custom Resources for a specific kind
(like MyCustomResource
). I'm using an informer
for this. An example of this is here https://github.com/fabric8io/kubernetes-client/blob/main/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CustomResourceInformerExample.java
Now, I want to go one step beyond, and I want to react to any kind of Custom Resources.
I've tried using the GenericKubernetesResource
like this
SharedIndexInformer<GenericKubernetesResource> informer = client.resources(GenericKubernetesResource.class)
.inNamespace(kubernetesClientConfig.getConfig().getNamespace())
.inform(myHandler, 60 * 1000L);
But at the time of running, I get this error:
18:33:13.563 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: resources cannot be called with a generic type
io.fabric8.kubernetes.client.KubernetesClientException: resources cannot be called with a generic type
at io.fabric8.kubernetes.client.impl.BaseClient.resources(BaseClient.java:305)
at io.fabric8.kubernetes.client.Client.resources(Client.java:175)
at io.fabric8.kubernetes.client.KubernetesClient.resources(KubernetesClient.java:143)
Any help to implement an informer, using Kubernetes fabric8 library, to get a notice about any possible Custom Resource?