Skip to content

Commit 14c63bb

Browse files
committed
wip
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent d51f0e3 commit 14c63bb

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/PrimaryUpdateAndCacheUtils.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ private PrimaryUpdateAndCacheUtils() {}
2828
* @return updated resource
2929
* @param <P> primary resource type
3030
*/
31-
public static <P extends HasMetadata> P updateAndCacheStatusWithLock(
32-
P primary, Context<P> context) {
33-
return patchAndCacheStatusWithLock(
34-
primary, context, (p, c) -> c.resource(primary).updateStatus());
31+
public static <P extends HasMetadata> P updateAndCacheStatusWith(P primary, Context<P> context) {
32+
return patchAndCacheStatusWith(primary, context, (p, c) -> c.resource(primary).updateStatus());
3533
}
3634

3735
/**
@@ -43,10 +41,8 @@ public static <P extends HasMetadata> P updateAndCacheStatusWithLock(
4341
* @return updated resource
4442
* @param <P> primary resource type
4543
*/
46-
public static <P extends HasMetadata> P patchAndCacheStatusWithLock(
47-
P primary, Context<P> context) {
48-
return patchAndCacheStatusWithLock(
49-
primary, context, (p, c) -> c.resource(primary).patchStatus());
44+
public static <P extends HasMetadata> P patchAndCacheStatusWith(P primary, Context<P> context) {
45+
return patchAndCacheStatusWith(primary, context, (p, c) -> c.resource(primary).patchStatus());
5046
}
5147

5248
/**
@@ -58,9 +54,9 @@ public static <P extends HasMetadata> P patchAndCacheStatusWithLock(
5854
* @return updated resource
5955
* @param <P> primary resource type
6056
*/
61-
public static <P extends HasMetadata> P editAndCacheStatusWithLock(
57+
public static <P extends HasMetadata> P editAndCacheStatusWith(
6258
P primary, Context<P> context, UnaryOperator<P> operation) {
63-
return patchAndCacheStatusWithLock(
59+
return patchAndCacheStatusWith(
6460
primary, context, (p, c) -> c.resource(primary).editStatus(operation));
6561
}
6662

@@ -74,7 +70,7 @@ public static <P extends HasMetadata> P editAndCacheStatusWithLock(
7470
* @return the updated resource.
7571
* @param <P> primary resource type
7672
*/
77-
public static <P extends HasMetadata> P patchAndCacheStatusWithLock(
73+
public static <P extends HasMetadata> P patchAndCacheStatusWith(
7874
P primary, Context<P> context, BiFunction<P, KubernetesClient, P> patch) {
7975
checkResourceVersionPresent(primary);
8076
var updatedResource = patch.apply(primary, context.getClient());
@@ -95,7 +91,7 @@ public static <P extends HasMetadata> P patchAndCacheStatusWithLock(
9591
* @return the updated resource.
9692
* @param <P> primary resource type
9793
*/
98-
public static <P extends HasMetadata> P ssaPatchAndCacheStatusWithLock(
94+
public static <P extends HasMetadata> P ssaPatchAndCacheStatusWith(
9995
P primary, P freshResourceWithStatus, Context<P> context) {
10096
checkResourceVersionPresent(freshResourceWithStatus);
10197
var res =

operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/statuscache/withlock/StatusPatchCacheWithLockReconciler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ public UpdateControl<StatusPatchCacheWithLockCustomResource> reconcile(
4141
.getStatus()
4242
.setValue(resource.getStatus() == null ? 1 : resource.getStatus().getValue() + 1);
4343

44+
resource.getMetadata().setResourceVersion(null);
4445
var updated =
45-
PrimaryUpdateAndCacheUtils.ssaPatchAndCacheStatusWithLock(resource, freshCopy, context);
46+
PrimaryUpdateAndCacheUtils.ssaPatchAndCacheStatusWith(resource, freshCopy, context);
4647
latestValue = updated.getStatus().getValue();
4748

4849
return UpdateControl.noUpdate();

0 commit comments

Comments
 (0)