gyfora commented on code in PR #512: URL: https://github.com/apache/flink-kubernetes-operator/pull/512#discussion_r1098512860
########## 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: I did not expect this to throw any exceptions, as the method also doesnt declare it -- 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