Class KubernetesDiscoveryClient
java.lang.Object
io.micronaut.kubernetes.discovery.KubernetesDiscoveryClient
- All Implemented Interfaces:
io.micronaut.core.naming.Described
,io.micronaut.discovery.DiscoveryClient
,Closeable
,AutoCloseable
@Singleton
@Requires(env="k8s") @Requires(property="kubernetes.client.discovery.enabled",notEquals="false",defaultValue="true")
public class KubernetesDiscoveryClient
extends Object
implements io.micronaut.discovery.DiscoveryClient
A
DiscoveryClient
implementation for Kubernetes using the API.- Since:
- 1.0.0
- Author:
- Álvaro Sánchez-Mariscal
-
Field Summary
-
Constructor Summary
ConstructorDescriptionKubernetesDiscoveryClient
(io.micronaut.kubernetes.client.reactor.CoreV1ApiReactorClient client, KubernetesConfiguration configuration, KubernetesConfiguration.KubernetesDiscoveryConfiguration discoveryConfiguration, List<KubernetesServiceConfiguration> serviceConfigurations, List<KubernetesServiceInstanceProvider> instanceProviders, KubernetesServiceInstanceList instanceList) Creates discovery client that supports the discovery modes. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
@NonNull String
org.reactivestreams.Publisher<List<io.micronaut.discovery.ServiceInstance>>
getInstances
(String serviceId) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.core.naming.Described
getDescription
-
Field Details
-
SERVICE_ID
- See Also:
-
LOG
protected static final org.slf4j.Logger LOG
-
-
Constructor Details
-
KubernetesDiscoveryClient
@Inject public KubernetesDiscoveryClient(io.micronaut.kubernetes.client.reactor.CoreV1ApiReactorClient client, KubernetesConfiguration configuration, KubernetesConfiguration.KubernetesDiscoveryConfiguration discoveryConfiguration, List<KubernetesServiceConfiguration> serviceConfigurations, List<KubernetesServiceInstanceProvider> instanceProviders, KubernetesServiceInstanceList instanceList) Creates discovery client that supports the discovery modes.- Parameters:
client
- An HTTP Client to query the Kubernetes API.configuration
- The configuration propertiesdiscoveryConfiguration
- The discovery configuration propertiesserviceConfigurations
- The manual service discovery configurationsinstanceProviders
- The service instance provider implementationsinstanceList
- TheKubernetesServiceInstanceList
-
-
Method Details
-
getInstances
public org.reactivestreams.Publisher<List<io.micronaut.discovery.ServiceInstance>> getInstances(String serviceId) - Specified by:
getInstances
in interfaceio.micronaut.discovery.DiscoveryClient
-
getServiceIds
- Specified by:
getServiceIds
in interfaceio.micronaut.discovery.DiscoveryClient
- Returns:
- A list of services metadata's name.
-
getDescription
- Specified by:
getDescription
in interfaceio.micronaut.core.naming.Described
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-