gaborgsomogyi commented on code in PR #512: URL: https://github.com/apache/flink-kubernetes-operator/pull/512#discussion_r1098504354
########## flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/health/HealthProbe.java: ########## @@ -17,19 +17,42 @@ package org.apache.flink.kubernetes.operator.health; +import io.javaoperatorsdk.operator.RuntimeInfo; +import lombok.Getter; +import lombok.Setter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.concurrent.atomic.AtomicBoolean; /** Flink operator health probe. */ public enum HealthProbe { Review Comment: Just wondering about this `HealthProbe` in general. This is a singleton + don't see any code which calls `markUnhealthy`. ########## flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/health/HealthProbe.java: ########## @@ -17,19 +17,42 @@ package org.apache.flink.kubernetes.operator.health; +import io.javaoperatorsdk.operator.RuntimeInfo; +import lombok.Getter; +import lombok.Setter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.concurrent.atomic.AtomicBoolean; /** Flink operator health probe. */ public enum HealthProbe { INSTANCE; + private static final Logger LOG = LoggerFactory.getLogger(HealthProbe.class); + private final AtomicBoolean isHealthy = new AtomicBoolean(true); + @Setter @Getter private RuntimeInfo runtimeInfo; + public void markUnhealthy() { isHealthy.set(false); } public boolean isHealthy() { - return isHealthy.get(); + if (!isHealthy.get()) { + return false; + } + + if (runtimeInfo != null) { + LOG.debug("Checking operator health"); + if (runtimeInfo.allEventSourcesAreHealthy()) { Review Comment: Do we mark to unhealthy if this function throws exception? `SimpleChannelInboundHandler` instances are behaving weird such cases. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org