Module io.inverno.mod.discovery.http.k8s
module io.inverno.mod.discovery.http.k8s
The Inverno framework HTTP Kubernetes discovery module provides services to resolve HTTP services in a Kubernetes cluster.
The module defines the following sockets:
- httpClient (required)
- the HTTP client
- configuration
- the HTTP discovery meta module configuration
It exposes the following beans:
- configuration
- the HTTP discovery meta module configuration
- k8sEnvHttpDiscoveryService
- the Kubernetes environment HTTP discovery service
The Kubernetes environment HTTP discovery service resolves services from service environment variables, a Kubernetes environment HTTP service URI being of the form
k8s-env://<service_name>
.
HttpClient httpClient = ...
K8s k8sDiscoveryModule = new K8s.Builder(httpClient).build();
try {
k8sDiscoveryModule.start();
httpClient.exchange("/")
.flatMap(exchange -> k8sDiscoveryModule.k8sEnvHttpDiscoveryService().resolve(ServiceId.of("k8s-env://sampleService")) // resolve the meta service
.flatMap(service -> service.getInstance(exchange)) // get an instance
.map(serviceInstance -> serviceInstance.bind(exchange)) // bind the exchange to the instance
)
.flatMap(Exchange::response) // send the request
...
}
finally {
k8sDiscoveryModule.stop();
}
- Since:
- 1.12
- Author:
- Jeremy Kuhn
-
Packages
PackageDescriptionInverno HTTP Kubernetes Discovery Service API and module configuration.FromPackagesio.inverno.mod.base io.inverno.mod.base.concurrent io.inverno.mod.base.converter io.inverno.mod.base.net io.inverno.mod.base.reflect io.inverno.mod.base.resource -
Modules
ModifierModuleDescriptiontransitiveDefines the foundational APIs of the Inverno framework modules.transitiveThe Inverno framework discovery module defines the API used for service discovery.transitiveThe Inverno framework HTTP service discovery module defines the API for HTTP service discovery and provides the DNS based HTTP discovery service.transitiveThe Inverno framework HTTP client module provides an HTTP1.x and HTTP/2 client.ModifierModuleDescriptiontransitiveThe Inverno framework HTTP base module defines base APIs and services for HTTP client and server implementations.