gaborgsomogyi commented on code in PR #512: URL: https://github.com/apache/flink-kubernetes-operator/pull/512#discussion_r1098516450
########## 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: Let's say `io.javaoperatorsdk.operator.RuntimeInfo` throws NPE randomly because of SDK issue. -- 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