File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed
operator-framework-core/src/main/java/io/javaoperatorsdk/operator Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -505,6 +505,21 @@ default boolean useSSAToPatchPrimaryResource() {
505
505
return true ;
506
506
}
507
507
508
+ /**
509
+ * {@link io.javaoperatorsdk.operator.api.reconciler.UpdateControl} patch resource or status can
510
+ * either use simple patches or SSA. Setting this to {@code true}, controllers will use SSA for
511
+ * adding finalizers, patching resources and status.
512
+ *
513
+ * @return {@code true} if Server-Side Apply (SSA) should be used when managing finalizers,
514
+ * {@code false} otherwise
515
+ * @see ConfigurationServiceOverrider#withUseSSAToManageFinalizer(boolean)
516
+ * @since 5.1.2
517
+ */
518
+ default boolean useSSAToManageFinalizer () {
519
+ return true ;
520
+ }
521
+
522
+
508
523
/**
509
524
* Determines whether resources retrieved from caches such as via calls to {@link
510
525
* Context#getSecondaryResource(Class)} should be defensively cloned first.
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ public class ConfigurationServiceOverrider {
39
39
private Boolean previousAnnotationForDependentResources ;
40
40
private Boolean parseResourceVersions ;
41
41
private Boolean useSSAToPatchPrimaryResource ;
42
+ private Boolean useSSAToManageFinalizer ;
42
43
private Boolean cloneSecondaryResourcesWhenGettingFromCache ;
43
44
private Set <Class <? extends HasMetadata >> previousAnnotationUsageBlocklist ;
44
45
@@ -183,6 +184,11 @@ public ConfigurationServiceOverrider withUseSSAToPatchPrimaryResource(boolean va
183
184
return this ;
184
185
}
185
186
187
+ public ConfigurationServiceOverrider withUseSSAToManageFinalizer (boolean value ) {
188
+ this .useSSAToManageFinalizer = value ;
189
+ return this ;
190
+ }
191
+
186
192
public ConfigurationServiceOverrider withCloneSecondaryResourcesWhenGettingFromCache (
187
193
boolean value ) {
188
194
this .cloneSecondaryResourcesWhenGettingFromCache = value ;
@@ -336,6 +342,12 @@ public boolean useSSAToPatchPrimaryResource() {
336
342
useSSAToPatchPrimaryResource , ConfigurationService ::useSSAToPatchPrimaryResource );
337
343
}
338
344
345
+ @ Override
346
+ public boolean useSSAToManageFinalizer () {
347
+ return overriddenValueOrDefault (
348
+ useSSAToManageFinalizer , ConfigurationService ::useSSAToPatchPrimaryResource );
349
+ }
350
+
339
351
@ Override
340
352
public boolean cloneSecondaryResourcesWhenGettingFromCache () {
341
353
return overriddenValueOrDefault (
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ class ReconciliationDispatcher<P extends HasMetadata> {
42
42
private final boolean retryConfigurationHasZeroAttempts ;
43
43
private final Cloner cloner ;
44
44
private final boolean useSSA ;
45
+ private final boolean useSSAForFinalizer ;
45
46
46
47
ReconciliationDispatcher (Controller <P > controller , CustomResourceFacade <P > customResourceFacade ) {
47
48
this .controller = controller ;
@@ -52,6 +53,7 @@ class ReconciliationDispatcher<P extends HasMetadata> {
52
53
var retry = configuration .getRetry ();
53
54
retryConfigurationHasZeroAttempts = retry == null || retry .initExecution ().isLastAttempt ();
54
55
useSSA = configuration .getConfigurationService ().useSSAToPatchPrimaryResource ();
56
+ useSSAForFinalizer = configuration .getConfigurationService ().useSSAToManageFinalizer ();
55
57
}
56
58
57
59
public ReconciliationDispatcher (Controller <P > controller ) {
@@ -119,7 +121,7 @@ private PostExecutionControl<P> handleReconcile(
119
121
* finalizer.
120
122
*/
121
123
P updatedResource ;
122
- if (useSSA ) {
124
+ if (useSSAForFinalizer ) {
123
125
updatedResource = addFinalizerWithSSA (originalResource );
124
126
} else {
125
127
updatedResource = updateCustomResourceWithFinalizer (resourceForExecution , originalResource );
You can’t perform that action at this time.
0 commit comments