@@ -7,27 +7,32 @@ public interface ResourceController<R extends CustomResource> {
7
7
8
8
/**
9
9
* The implementation should delete the associated component(s). Note that this is method is
10
- * called when an object is marked for deletion. After its executed the custom resource finalizer
11
- * is automatically removed by the framework; unless the return value is false - note that this is
12
- * almost never the case. Its important to have the implementation also idempotent, in the current
13
- * implementation to cover all edge cases actually will be executed mostly twice.
10
+ * called when an object is marked for deletion. After it's executed the custom resource finalizer
11
+ * is automatically removed by the framework; unless the return value is {@link
12
+ * DeleteControl#NO_FINALIZER_REMOVAL} - note that this is almost never the case. It's important
13
+ * to have the implementation also idempotent, in the current implementation to cover all edge
14
+ * cases actually will be executed mostly twice.
14
15
*
15
16
* @param resource
16
- * @return true - so the finalizer is automatically removed after the call. false if you don't
17
- * want to remove the finalizer. Note that this is ALMOST NEVER the case.
17
+ * @return {@link DeleteControl#DEFAULT_DELETE} - so the finalizer is automatically removed after
18
+ * the call. {@link DeleteControl#NO_FINALIZER_REMOVAL} if you don't want to remove the
19
+ * finalizer. Note that this is ALMOST NEVER the case.
18
20
*/
19
- DeleteControl deleteResource (R resource , Context <R > context );
21
+ default DeleteControl deleteResource (R resource , Context <R > context ) {
22
+ return DeleteControl .DEFAULT_DELETE ;
23
+ }
20
24
21
25
/**
22
26
* The implementation of this operation is required to be idempotent. Always use the UpdateControl
23
27
* object to make updates on custom resource if possible. Also always use the custom resource
24
28
* parameter (not the custom resource that might be in the events)
25
29
*
26
- * @return The resource is updated in api server if the return value is present within Optional.
27
- * This the common use cases. However in cases, for example the operator is restarted, and we
28
- * don't want to have an update call to k8s api to be made unnecessarily, by returning an
29
- * empty Optional this update can be skipped. <b>However we will always call an update if
30
- * there is no finalizer on object and its not marked for deletion.</b>
30
+ * @return The resource is updated in api server if the return value is not {@link
31
+ * UpdateControl#noUpdate()}. This the common use cases. However in cases, for example the
32
+ * operator is restarted, and we don't want to have an update call to k8s api to be made
33
+ * unnecessarily, by returning {@link UpdateControl#noUpdate()} this update can be skipped.
34
+ * <b>However we will always call an update if there is no finalizer on object and it's not
35
+ * marked for deletion.</b>
31
36
*/
32
37
UpdateControl <R > createOrUpdateResource (R resource , Context <R > context );
33
38
0 commit comments