Class StatusRecorder<STATUS extends CommonStatus<?>>


  • public class StatusRecorder<STATUS extends CommonStatus<?>>
    extends java.lang.Object
    Helper class for status management and updates.
    • Field Detail

      • objectMapper

        protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper
      • statusCache

        protected final java.util.concurrent.ConcurrentHashMap<org.apache.flink.api.java.tuple.Tuple2<java.lang.String,​java.lang.String>,​com.fasterxml.jackson.databind.node.ObjectNode> statusCache
    • Method Detail

      • patchAndCacheStatus

        public <T extends AbstractFlinkResource<?,​STATUS>> void patchAndCacheStatus​(T 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.
        Type Parameters:
        T - Resource type.
        Parameters:
        resource - Resource for which status update should be performed
      • updateStatusFromCache

        public <T extends AbstractFlinkResource<?,​STATUS>> void updateStatusFromCache​(T 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.

        Type Parameters:
        T - Custom resource type.
        Parameters:
        resource - Resource for which the status should be updated from the cache
      • removeCachedStatus

        public <T extends AbstractFlinkResource<?,​STATUS>> void removeCachedStatus​(T resource)
        Remove cached status for Flink resource.
        Type Parameters:
        T - Resource type.
        Parameters:
        resource - Flink resource.
      • getKey

        protected static org.apache.flink.api.java.tuple.Tuple2<java.lang.String,​java.lang.String> getKey​(io.fabric8.kubernetes.api.model.HasMetadata resource)