Skip to content

Commit fb090a3

Browse files
committed
docs
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent 68471f7 commit fb090a3

File tree

1 file changed

+19
-27
lines changed
  • operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer

1 file changed

+19
-27
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSource.java

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,41 +22,33 @@
2222

2323
/**
2424
* 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.
2727
*
2828
* <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:
3131
*
3232
* <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
3736
* 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
4042
* 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
4345
* additional checks. After a new event is received the cached object is removed from this
4446
* 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.
6052
* </ol>
6153
*
6254
* @param <R> resource type being watched

0 commit comments

Comments
 (0)