ApiType
- api type of the reconcilerpublic interface ResourceReconciler<ApiType extends io.kubernetes.client.common.KubernetesObject>
The ResourceReconciler operations are required to be idempotent as the reconciliation loop is executed every time there is a change of the resource.
This interface is meant to be used in combination with the Operator
annotation where the subject of reconciliation
is specified:
@Operator(informer = @Informer(apiType = V1ConfigMap.class, apiListType = V1ConfigMapList.class))) public class MyReconciler implements ResourceReconciler<V1ConfigMap> { @Override public Result reconcile(@NonNull Request request, @NonNull OperatorResourceLister<V1ConfigMap> lister) { Optional<V1ConfigMap> resource = lister.get(request); // reconcile return new Result(false); } }
Modifier and Type | Method and Description |
---|---|
io.kubernetes.client.extended.controller.reconciler.Result |
reconcile(io.kubernetes.client.extended.controller.reconciler.Request request,
OperatorResourceLister<ApiType> lister)
Reconcile the resource identified by the
Request . |
@NonNull io.kubernetes.client.extended.controller.reconciler.Result reconcile(@NonNull io.kubernetes.client.extended.controller.reconciler.Request request, @NonNull OperatorResourceLister<ApiType> lister)
Request
. This operation is required to be idempotent.
The OperatorResourceLister
lister
is used to retrieve resource from the local
Cache
.
The lister
returns empty optional if the resource was deleted. Always use finalizers
to properly reconcile on resource deletion.
request
- requestlister
- lister for given operator's reconciler