Skip to content

Commit ee0c9ed

Browse files
committed
docs: update docs
1 parent b82c1f1 commit ee0c9ed

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

docs/documentation/features.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ execution.
3737
[Kubernetes finalizers](https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers/)
3838
make sure that a reconciliation happens when a custom resource is instructed to be deleted. Typical case when it's
3939
useful, when an operator is down (pod not running). Without a finalizer the reconciliation - thus the cleanup -
40-
i.e. [`Reconciler.cleanup(...)`](https://github.com/java-operator-sdk/java-operator-sdk/blob/b91221bb54af19761a617bf18eef381e8ceb3b4c/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Reconciler.java#L31)
40+
i.e. [`Cleaner.cleanup(...)`](https://github.com/java-operator-sdk/java-operator-sdk/blob/b82c1f106968cb3eb18835c5e9cd1e4d5c40362e/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Cleaner.java#L28-L28)
4141
would not happen if a custom resource is deleted.
4242

43+
To use finalizers the reconciler have to implement [`Cleaner<P>`](https://github.com/java-operator-sdk/java-operator-sdk/blob/b82c1f106968cb3eb18835c5e9cd1e4d5c40362e/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Cleaner.java) interface.
44+
In other words, finalizer is added if the `Reconciler` implements `Cleaner` interface. If not, no
45+
finalizer is added and/or removed.
46+
4347
Finalizers are automatically added by the framework as the first step, thus after a custom resource is created, but
4448
before the first reconciliation. The finalizer is added via a separate Kubernetes API call. As a result of this update,
4549
the finalizer will be present. The subsequent event will be received, which will trigger the first reconciliation.
@@ -50,7 +54,6 @@ in some specific corner cases, when there would be a long waiting period for som
5054

5155
The name of the finalizers can be specified, in case it is not, a name will be generated.
5256

53-
Automatic finalizer handling can be turned off, so when configured no finalizer will be added or removed.
5457
See [`@ControllerConfiguration`](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/ControllerConfiguration.java)
5558
annotation for more details.
5659

@@ -66,7 +69,7 @@ When automatic finalizer handling is turned off, the `Reconciler.cleanup(...)` m
6669
case when a delete event received. So it does not make sense to implement this method and turn off finalizer at the same
6770
time.
6871

69-
## The `reconcile` and `cleanup` Methods of [`Reconciler`](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Reconciler.java)
72+
## The `reconcile` and [`cleanup`](https://github.com/java-operator-sdk/java-operator-sdk/blob/b82c1f106968cb3eb18835c5e9cd1e4d5c40362e/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Cleaner.java) Methods on a [`Reconciler`](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Reconciler.java)
7073

7174
The lifecycle of a custom resource can be clearly separated into two phases from the perspective of an operator. When a
7275
custom resource is created or update, or on the other hand when the custom resource is deleted - or rather marked for
@@ -75,9 +78,8 @@ deletion in case a finalizer is used.
7578
This separation-related logic is automatically handled by the framework. The framework will always call `reconcile`
7679
method, unless the custom resource is
7780
[marked from deletion](https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers/#how-finalizers-work)
78-
. From the point when the custom resource is marked from deletion, only the `cleanup` method is called.
79-
80-
If there is **no finalizer** in place (see Finalizer Support section), the `cleanup` method is **not called**.
81+
. From the point when the custom resource is marked from deletion, only the `cleanup` method is called, of course
82+
only if the reconciler implements the `Cleaner` interface.
8183

8284
### Using [`UpdateControl`](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/UpdateControl.java) and [`DeleteControl`](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/DeleteControl.java)
8385

0 commit comments

Comments
 (0)