How to monitore custom objects (CustomResourceDefinition instances) updates

1/8/2020

I'm using k8s client in java - client-java-extended.

I'm trying to use DefaultSharedIndexInformer, which creates Controller and which creates ReflectorRunnable to get notifications when my custom object (** CustomResourceDefinition** instance) changes. I assume that it means "watching".

However I noticed that on line 49 ReflectorRunnable does the following:

List<ApiType> items = ListAccessor.getItems(list);

For me it means that it gets existing list of custom objects and do something called "watching", but it apparently doesn't see any changes in my custom objects. Only if I manually execute

       ListAccessor.getItems(list);

I can get updated list of my custom objects and/or updated version or given custom object.

So my question is if I misunderstood terms "watching" or I'm missing something else. Should I manually create ReflectorRunnable and fire

run()

in a loop to be able to see this changes? Or this is correct approach but mu k8s is doing something stupid?

Please help

Michał

-- Michał S
java
kubernetes-custom-resources

0 Answers