|
22 | 22 |
|
23 | 23 | /** |
24 | 24 | * Wraps informer(s) so they are connected to the eventing system of the framework. Note that since |
25 | | - * this is built on top of Fabric8 client Informers, it also supports caching resources using caching from |
26 | | - * informer caches as well as additional caches described below. |
| 25 | + * this is built on top of Fabric8 client Informers, it also supports caching resources using |
| 26 | + * caching from informer caches as well as additional caches described below. |
27 | 27 | * |
28 | 28 | * <p>InformerEventSource also supports two features to better handle events and caching of |
29 | | - * resources on top of Informers from the Fabric8 Kubernetes client. These two features |
30 | | - * are related to each other as follows: |
| 29 | + * resources on top of Informers from the Fabric8 Kubernetes client. These two features are related |
| 30 | + * to each other as follows: |
31 | 31 | * |
32 | 32 | * <ol> |
33 | | - * <li>Ensuring the cache contains the fresh resource after an update. This is |
34 | | - * important for {@link |
35 | | - * io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource} and mainly for |
36 | | - * {@link |
| 33 | + * <li>Ensuring the cache contains the fresh resource after an update. This is important for |
| 34 | + * {@link io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource} and mainly |
| 35 | + * for {@link |
37 | 36 | * io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependentResource} so |
38 | | - * that {@link io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource#getSecondaryResource(HasMetadata, Context)} always returns the latest version of the resource after a reconciliation. To achieve this |
39 | | - * {@link #handleRecentResourceUpdate(ResourceID, HasMetadata, HasMetadata)} and {@link #handleRecentResourceCreate(ResourceID, HasMetadata)} need to be called explicitly |
| 37 | + * that {@link |
| 38 | + * io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource#getSecondaryResource(HasMetadata, |
| 39 | + * Context)} always returns the latest version of the resource after a reconciliation. To |
| 40 | + * achieve this {@link #handleRecentResourceUpdate(ResourceID, HasMetadata, HasMetadata)} and |
| 41 | + * {@link #handleRecentResourceCreate(ResourceID, HasMetadata)} need to be called explicitly |
40 | 42 | * after a resource is created or updated using the kubernetes client. These calls are done |
41 | | - * automatically by the KubernetesDependentResource implementation. In the background this will |
42 | | - * store the new resource in a temporary cache {@link TemporaryResourceCache} which does |
| 43 | + * automatically by the KubernetesDependentResource implementation. In the background this |
| 44 | + * will store the new resource in a temporary cache {@link TemporaryResourceCache} which does |
43 | 45 | * additional checks. After a new event is received the cached object is removed from this |
44 | 46 | * cache, since it is then usually already in the informer cache. |
45 | | - * <li>Avoiding unneeded reconciliations after resources are created or updated. This filters out events that are the results of updates and creates made |
46 | | - * by the controller itself because we typically don't want the associated informer to trigger an event causing a useless reconciliation (as the change originates from the reconciler itself). This is achieved |
47 | | - * by |
48 | | - * TODO: update as this mentions methods that don't exist anymore and isn't very clear |
49 | | - * |
50 | | - * {@link #prepareForCreateOrUpdateEventFiltering(..) method needs to be called before the operation |
51 | | - * of the k8s client. And the operation from point 1. after the k8s client call. See its |
52 | | - * usage in CreateUpdateEventFilterTestReconciler integration test for the usage. (Again this |
53 | | - * is managed for the developer if using dependent resources.) <br> |
54 | | - * Roughly it works in a way that before the K8S API call is made, we set mark the resource |
55 | | - * ID, and from that point informer won't propagate events further just will start record |
56 | | - * them. After the client operation is done, it's checked and analysed what events were |
57 | | - * received and based on that it will propagate event or not and/or put the new resource into |
58 | | - * the temporal cache - so if the event not arrived yet about the update will be able to |
59 | | - * filter it in the future. |
| 47 | + * <li>Avoiding unneeded reconciliations after resources are created or updated. This filters out |
| 48 | + * events that are the results of updates and creates made by the controller itself because we |
| 49 | + * typically don't want the associated informer to trigger an event causing a useless |
| 50 | + * reconciliation (as the change originates from the reconciler itself). For the details see |
| 51 | + * {@link #canSkipEvent(HasMetadata, HasMetadata, ResourceID)} and related usage. |
60 | 52 | * </ol> |
61 | 53 | * |
62 | 54 | * @param <R> resource type being watched |
|
0 commit comments