Class StatusRecorder<CR extends org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,STATUS>,STATUS extends org.apache.flink.kubernetes.operator.api.status.CommonStatus<?>>
- java.lang.Object
-
- org.apache.flink.kubernetes.operator.utils.StatusRecorder<CR,STATUS>
-
public class StatusRecorder<CR extends org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,STATUS>,STATUS extends org.apache.flink.kubernetes.operator.api.status.CommonStatus<?>> extends java.lang.ObjectHelper class for status management and updates.
-
-
Field Summary
Fields Modifier and Type Field Description protected com.fasterxml.jackson.databind.ObjectMapperobjectMapperprotected java.util.concurrent.ConcurrentHashMap<io.javaoperatorsdk.operator.processing.event.ResourceID,com.fasterxml.jackson.databind.node.ObjectNode>statusCache
-
Constructor Summary
Constructors Constructor Description StatusRecorder(io.fabric8.kubernetes.client.KubernetesClient client, MetricManager<CR> metricManager, java.util.function.BiConsumer<CR,STATUS> statusUpdateListener)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <S extends org.apache.flink.kubernetes.operator.api.status.CommonStatus<?>,CR extends org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,S>>
StatusRecorder<CR,S>create(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, MetricManager<CR> metricManager, java.util.Collection<org.apache.flink.kubernetes.operator.api.listener.FlinkResourceListener> listeners)voidpatchAndCacheStatus(CR resource)Update the status of the provided kubernetes resource on the k8s cluster.voidremoveCachedStatus(CR resource)Remove cached status for Flink resource.voidupdateStatusFromCache(CR resource)Update the custom resource status based on the in-memory cached to ensure that any status updates that we made previously are always visible in the reconciliation loop.
-
-
-
Constructor Detail
-
StatusRecorder
public StatusRecorder(io.fabric8.kubernetes.client.KubernetesClient client, MetricManager<CR> metricManager, java.util.function.BiConsumer<CR,STATUS> statusUpdateListener)
-
-
Method Detail
-
patchAndCacheStatus
public void patchAndCacheStatus(CR resource)
Update the status of the provided kubernetes resource on the k8s cluster. We use patch together with null resourceVersion to try to guarantee that the status update succeeds even if the underlying resource spec was update in the meantime. This is necessary for the correct operator behavior.- Parameters:
resource- Resource for which status update should be performed
-
updateStatusFromCache
public void updateStatusFromCache(CR resource)
Update the custom resource status based on the in-memory cached to ensure that any status updates that we made previously are always visible in the reconciliation loop. This is required due to our custom status patching logic.If the cache doesn't have a status stored, we do no update. This happens when the operator reconciles a resource for the first time after a restart.
- Parameters:
resource- Resource for which the status should be updated from the cache
-
removeCachedStatus
public void removeCachedStatus(CR resource)
Remove cached status for Flink resource.- Parameters:
resource- Flink resource.
-
create
public static <S extends org.apache.flink.kubernetes.operator.api.status.CommonStatus<?>,CR extends org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,S>> StatusRecorder<CR,S> create(io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, MetricManager<CR> metricManager, java.util.Collection<org.apache.flink.kubernetes.operator.api.listener.FlinkResourceListener> listeners)
-
-