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
To contrast, see the same sample, this time [without SSA](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework/src/test/java/io/javaoperatorsdk/operator/sample/patchresourceandstatusnossa/PatchResourceAndStatusNoSSAReconciler.java#L16-L16).
104
+
105
+
Non-SSA based patch is still supported.
106
+
You can control whether or not to use SSA
107
+
using [`ConfigurationServcice.useSSAToPatchPrimaryResource()`](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java#L385-L385)
108
+
and the related `ConfigurationServiceOverrider.withUseSSAToPatchPrimaryResource` method.
109
+
Related integration test can be
110
+
found [here](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework/src/test/java/io/javaoperatorsdk/operator/sample/patchresourceandstatusnossa/PatchResourceAndStatusNoSSAReconciler.java).
111
+
112
+
Handling resources directly using the client, instead of delegating these updates operations to JOSDK by returning
113
+
an `UpdateControl` at the end of your reconciliation, should work appropriately. However, we do recommend to
114
+
use `UpdateControl` instead since JOSDK makes sure that the operations are handled properly, since there are subtleties
115
+
to be aware of. For example, if you are using a finalizer, JOSDK makes sure to include it in your fully specified intent
116
+
so that it is not unintentionally removed from the resource (which would happen if you omit it, since your controller is
117
+
the designated manager for that field and Kubernetes interprets the finalizer being gone from the specified intent as a
annotation. If you do not specify a finalizer name, one will be automatically generated for you.
172
186
187
+
From v5 by default finalizer is added using Served Side Apply. See also UpdateControl in docs.
188
+
173
189
## Automatic Observed Generation Handling
174
190
175
191
Having an `.observedGeneration` value on your resources' status is a best practice to
@@ -187,11 +203,14 @@ In order to have this feature working:
187
203
So the status should be instantiated when the object is returned using the `UpdateControl`.
188
204
189
205
If these conditions are fulfilled and generation awareness is activated, the observed generation
190
-
is automatically set by the framework after the `reconcile` method is called. Note that the
191
-
observed generation is also updated even when `UpdateControl.noUpdate()` is returned from the
192
-
reconciler. See this feature at work in
193
-
the [WebPage example](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/sample-operators/webpage/src/main/java/io/javaoperatorsdk/operator/sample/WebPageStatus.java#L5)
194
-
.
206
+
is automatically set by the framework after the `reconcile` method is called.
207
+
208
+
When using SSA based patches, the observed generation is only updated when `UpdateControl.patchStatus` or
209
+
`UpdateControl.patchResourceAndStatus` is returned. In case the of non-SSA based patches
210
+
the observed generation is also updated even when `UpdateControl.noUpdate()` is returned from the
211
+
reconciler.
212
+
See this feature at work in the [WebPage example](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/sample-operators/webpage/src/main/java/io/javaoperatorsdk/operator/sample/WebPageStatus.java#L5).
213
+
See turning off an on the SSA based patching at [`ConfigurationServcice.useSSAToPatchPrimaryResource()`](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java#L385-L385).
now contains all the utility methods used for event sources naming that were previously defined in
19
19
the `EventSourceInitializer` interface.
20
-
3.Patching status through `UpdateControl`like the `patchStatus` method now by default
21
-
uses Server Side Apply instead of simple patch. To use the former approach, use the feature flag
22
-
in [`ConfigurationService`](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java#L400-L400)
20
+
3.Updates through `UpdateControl`now use [Server Side Apply (SSA)](https://kubernetes.io/docs/reference/using-api/server-side-apply/)by default to add the finalizer and for all
21
+
the patch operations in `UpdateControl`. The update operations were removed. If you do not wish to use SSA, you can deactivate the feature using `ConfigurationService.useSSAToPatchPrimaryResource` and related `ConfigurationServiceOverrider.withUseSSAToPatchPrimaryResource`.
22
+
23
23
!!! IMPORTANT !!!
24
-
Migration from a non-SSA based controller to SSA based controller can cause problems, due to known issues.
25
-
See the
26
-
following [integration test](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework/src/test/java/io/javaoperatorsdk/operator/StatusPatchSSAMigrationIT.java#L71-L82)
24
+
25
+
See known issues with migration from non-SSA to SSA based status updates here:
where it is demonstrated. Also, the related part of
28
28
a [workaround](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework/src/test/java/io/javaoperatorsdk/operator/StatusPatchSSAMigrationIT.java#L110-L116).
29
+
30
+
Related automatic observed generation handling changes:
31
+
Automated Observed Generation (see features in docs), is automatically handled for non-SSA, even if
32
+
the status sub-resource is not instructed to be updated. This is not true for SSA, observed generation is updated
33
+
only when patch status is instructed by `UpdateControl`.
34
+
29
35
4.`ManagedDependentResourceContext` has been renamed to `ManagedWorkflowAndDependentResourceContext` and is accessed
30
36
via the accordingly renamed `managedWorkflowAndDependentResourceContext` method.
31
37
5.`ResourceDiscriminator` was removed. In most of the cases you can just delete the discriminator, everything should
0 commit comments