You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/PrimaryUpdateAndCacheUtils.java
+37-40Lines changed: 37 additions & 40 deletions
Original file line number
Diff line number
Diff line change
@@ -14,13 +14,13 @@
14
14
15
15
/**
16
16
* Utility methods to patch the primary resource state and store it to the related cache, to make
17
-
* sure that fresh resource is present for the next reconciliation. The main use case for such
18
-
* updates is to store state is resource status.
17
+
* sure that the latest version of the resource is present for the next reconciliation. The main use
18
+
* case for such updates is to store state is resource status.
19
19
*
20
20
* <p>The way the framework handles this is with retryable updates with optimistic locking, and
21
21
* caches the updated resource from the response in an overlay cache on top of the Informer cache.
22
-
* If the update fails, it reads the primary resource and applies the modifications again and
23
-
* retries the update.
22
+
* If the update fails, it reads the primary resource from the cluster, applies the modifications
23
+
* again and retries the update.
24
24
*/
25
25
publicclassPrimaryUpdateAndCacheUtils {
26
26
@@ -90,74 +90,71 @@ public static <P extends HasMetadata> P ssaPatchStatusAndCacheResource(
90
90
}
91
91
92
92
/**
93
-
* Modifies the primary using modificationFunction, then uses the modified resource for the
94
-
* request to update with provided update method. But before the update operation sets the
95
-
* resourceVersion to the modified resource from the primary resource, so there is always
96
-
* optimistic locking happening. If the request fails on optimistic update, we read the resource
97
-
* again from the K8S API server and retry the whole process. In short, we make sure we always
98
-
* update the resource with optimistic locking, after we cache the resource in internal cache.
99
-
* Without further going into the details, the optimistic locking is needed so we can reliably
100
-
* handle the caching.
93
+
* Same as {@link #updateAndCacheResource(HasMetadata, Context, UnaryOperator, UnaryOperator,
94
+
* int)} using the default maximum retry number as defined by {@link #DEFAULT_MAX_RETRY}.
101
95
*
102
-
* @param primary original resource to update
96
+
* @param resourceToUpdate original resource to update
103
97
* @param context of reconciliation
104
98
* @param modificationFunction modifications to make on primary
105
99
* @param updateMethod the update method implementation
0 commit comments