Missing health initializer bean
@@ -18,17 +18,22 @@ package org.springframework.cloud.kubernetes.discovery;
import io.fabric8.kubernetes.client.KubernetesClient;
+import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.client.CommonsClientAutoConfiguration;
import org.springframework.cloud.client.ConditionalOnBlockingDiscoveryEnabled;
import org.springframework.cloud.client.ConditionalOnDiscoveryEnabled;
+import org.springframework.cloud.client.ConditionalOnDiscoveryHealthIndicatorEnabled;
import org.springframework.cloud.client.discovery.simple.SimpleDiscoveryClientAutoConfiguration;
import org.springframework.cloud.kubernetes.ConditionalOnKubernetesEnabled;
import org.springframework.cloud.kubernetes.KubernetesAutoConfiguration;
+import org.springframework.cloud.kubernetes.PodUtils;
import org.springframework.cloud.kubernetes.registry.KubernetesRegistration;
import org.springframework.cloud.kubernetes.registry.KubernetesServiceRegistry;
+import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -92,6 +97,21 @@ public class KubernetesDiscoveryClientAutoConfiguration {
return new KubernetesDiscoveryProperties();
}
+ @ConditionalOnClass({ HealthIndicator.class })
+ @ConditionalOnDiscoveryEnabled
+ @ConditionalOnDiscoveryHealthIndicatorEnabled
+ @Configuration
+ public static class KubernetesDiscoveryClientHealthIndicatorConfiguration {
+
+ @Bean
+ public KubernetesDiscoveryClientHealthIndicatorInitializer indicatorInitializer(
+ ApplicationEventPublisher applicationEventPublisher, PodUtils podUtils) {
+ return new KubernetesDiscoveryClientHealthIndicatorInitializer(podUtils,
+ applicationEventPublisher);
+ }
+
+ }
+
@Configuration(proxyBeanMethods = false)
@ConditionalOnBlockingDiscoveryEnabled
@ConditionalOnKubernetesDiscoveryEnabled
