in spark-operator/src/main/java/org/apache/spark/k8s/operator/probe/HealthProbe.java [87:115]
private boolean checkInformersHealth(RuntimeInfo operatorRuntimeInfo) {
log.debug("Checking informer health");
List<Boolean> informersHealthList = new ArrayList<>();
for (Map.Entry<String, Map<String, InformerWrappingEventSourceHealthIndicator>>
controllerEntry :
operatorRuntimeInfo.unhealthyInformerWrappingEventSourceHealthIndicator().entrySet()) {
for (Map.Entry<String, InformerWrappingEventSourceHealthIndicator> eventSourceEntry :
controllerEntry.getValue().entrySet()) {
Map<String, InformerHealthIndicator> informers =
eventSourceEntry.getValue().informerHealthIndicators();
for (Map.Entry<String, InformerHealthIndicator> informerEntry : informers.entrySet()) {
if (informerEntry.getValue().getStatus() == Status.HEALTHY) {
informersHealthList.add(true);
} else {
if (log.isErrorEnabled()) {
log.error(
"Controller: {}, Event Source: {}, Informer: {} is in {}, not a healthy state",
controllerEntry.getKey(),
eventSourceEntry.getKey(),
informerEntry.getValue().getStatus(),
informerEntry.getKey());
}
informersHealthList.add(false);
}
}
}
}
return informersHealthList.stream().reduce((a, b) -> a && b).orElse(true);
}