Class ResourceControllerAdapter<R extends io.fabric8.kubernetes.client.CustomResource>
- java.lang.Object
-
- com.github.containersolutions.operator.api.ResourceControllerAdapter<R>
-
- Type Parameters:
R-
- All Implemented Interfaces:
ResourceController<R>
public abstract class ResourceControllerAdapter<R extends io.fabric8.kubernetes.client.CustomResource> extends java.lang.Object implements ResourceController<R>
Provides a more clear interface for the most common use case.
-
-
Constructor Summary
Constructors Constructor Description ResourceControllerAdapter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidcreateOrUpdate(R resource, Context<R> context)java.util.Optional<R>createOrUpdateResource(R resource, Context<R> context)The implementation of this operation is required to be idempotent.abstract voiddelete(R resource, Context<R> context)booleandeleteResource(R resource, Context<R> context)The implementation should delete the associated component(s).
-
-
-
Method Detail
-
deleteResource
public boolean deleteResource(R resource, Context<R> context)
Description copied from interface:ResourceControllerThe implementation should delete the associated component(s). Note that this is method is called when an object is marked for deletion. After its executed the default finalizer is automatically removed by the framework; unless the return value is false - note that this is almost never the case.- Specified by:
deleteResourcein interfaceResourceController<R extends io.fabric8.kubernetes.client.CustomResource>- Returns:
- true - so the finalizer is automatically removed after the call. false if you don't want to remove the finalizer. Note that this is ALMOST NEVER the case.
-
createOrUpdateResource
public java.util.Optional<R> createOrUpdateResource(R resource, Context<R> context)
Description copied from interface:ResourceControllerThe implementation of this operation is required to be idempotent.- Specified by:
createOrUpdateResourcein interfaceResourceController<R extends io.fabric8.kubernetes.client.CustomResource>- Returns:
- The resource is updated in api server if the return value is present within Optional. This the common use cases. However in cases, for example the operator is restarted, and we don't want to have an update call to k8s api to be made unnecessarily, by returning an empty Optional this update can be skipped. However we will always call an update if there is no finalizer on object and its not marked for deletion.
-
-