Class ResourceControllerAdapter<R extends io.fabric8.kubernetes.client.CustomResource>

  • 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 Detail

      • ResourceControllerAdapter

        public ResourceControllerAdapter()
    • Method Detail

      • deleteResource

        public boolean deleteResource​(R resource,
                                      Context<R> context)
        Description copied from interface: ResourceController
        The 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:
        deleteResource in interface ResourceController<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: ResourceController
        The implementation of this operation is required to be idempotent.
        Specified by:
        createOrUpdateResource in interface ResourceController<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.
      • delete

        public abstract void delete​(R resource,
                                    Context<R> context)
      • createOrUpdate

        public abstract void createOrUpdate​(R resource,
                                            Context<R> context)