Bumping versions
This commit is contained in:
29
README.adoc
29
README.adoc
@@ -787,6 +787,35 @@ The Kubernetes health indicator (which is part of the core module) exposes the f
|
||||
|
||||
<TBD>
|
||||
|
||||
== LoadBalancer for Kubernetes
|
||||
This project includes Spring Cloud Load Balancer for load balancing based on Kubernetes Endpoints and provides implementation of load balancer based on Kubernetes Service.
|
||||
To include it to your project add the following dependency.
|
||||
====
|
||||
[source,xml]
|
||||
----
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
----
|
||||
====
|
||||
|
||||
To enable load balancing based on Kubernetes Service name use the following property. Then load balancer would try to call application using address, for example `service-a.default.svc.cluster.local`
|
||||
====
|
||||
[source]
|
||||
----
|
||||
spring.cloud.kubernetes.loadbalancer.mode=SERVICE
|
||||
----
|
||||
====
|
||||
|
||||
To enabled load balancing across all namespaces use the following property. Property from `spring-cloud-kubernetes-discovery` module is respected.
|
||||
====
|
||||
[source]
|
||||
----
|
||||
spring.cloud.kubernetes.discovery.all-namespaces=true
|
||||
----
|
||||
====
|
||||
|
||||
== Security Configurations Inside Kubernetes
|
||||
|
||||
|
||||
|
||||
@@ -64,6 +64,10 @@
|
||||
|spring.cloud.kubernetes.discovery.service-labels | | If set, then only the services matching these labels will be fetched from the Kubernetes API server.
|
||||
|spring.cloud.kubernetes.discovery.service-name | unknown | The service name of the local instance.
|
||||
|spring.cloud.kubernetes.enabled | true | Whether to enable Kubernetes integration.
|
||||
|spring.cloud.kubernetes.loadbalancer.cluster-domain | cluster.local | cluster domain.
|
||||
|spring.cloud.kubernetes.loadbalancer.enabled | true | Load balancer enabled,default true.
|
||||
|spring.cloud.kubernetes.loadbalancer.mode | | {@link KubernetesLoadBalancerMode} setting load balancer server list with ip of pod or service name. default value is POD.
|
||||
|spring.cloud.kubernetes.loadbalancer.port-name | http | service port name.
|
||||
|spring.cloud.kubernetes.reload.enabled | false | Enables the Kubernetes configuration reload on change.
|
||||
|spring.cloud.kubernetes.reload.max-wait-for-restart | 2s | If Restart or Shutdown strategies are used, Spring Cloud Kubernetes waits a random amount of time before restarting. This is done in order to avoid having all instances of the same application restart at the same time. This property configures the maximum of amount of wait time from the moment the signal is received that a restart is needed until the moment the restart is actually triggered
|
||||
|spring.cloud.kubernetes.reload.mode | | Sets the detection mode for Kubernetes configuration reload.
|
||||
|
||||
@@ -99,8 +99,8 @@ public class HttpBasedConfigurationWatchChangeDetectorTests {
|
||||
fooEndpointPort.setPort(wireMockRule.port());
|
||||
List<ServiceInstance> instances = new ArrayList<>();
|
||||
KubernetesServiceInstance fooServiceInstance = new KubernetesServiceInstance(
|
||||
"foo", "foo", fooEndpointAddress.getIp(), fooEndpointPort.getPort(), new HashMap<>(),
|
||||
false);
|
||||
"foo", "foo", fooEndpointAddress.getIp(), fooEndpointPort.getPort(),
|
||||
new HashMap<>(), false);
|
||||
instances.add(fooServiceInstance);
|
||||
when(reactiveDiscoveryClient.getInstances(eq("foo")))
|
||||
.thenReturn(Flux.fromIterable(instances));
|
||||
@@ -185,7 +185,8 @@ public class HttpBasedConfigurationWatchChangeDetectorTests {
|
||||
fooEndpointPort.setPort(wireMockRule.port());
|
||||
List<ServiceInstance> instances = new ArrayList<>();
|
||||
KubernetesServiceInstance fooServiceInstance = new KubernetesServiceInstance(
|
||||
"foo", "foo", fooEndpointAddress.getIp(), fooEndpointPort.getPort(), metadata, false);
|
||||
"foo", "foo", fooEndpointAddress.getIp(), fooEndpointPort.getPort(),
|
||||
metadata, false);
|
||||
instances.add(fooServiceInstance);
|
||||
when(reactiveDiscoveryClient.getInstances(eq("foo")))
|
||||
.thenReturn(Flux.fromIterable(instances));
|
||||
@@ -211,7 +212,8 @@ public class HttpBasedConfigurationWatchChangeDetectorTests {
|
||||
fooEndpointPort.setPort(wireMockRule.port());
|
||||
List<ServiceInstance> instances = new ArrayList<>();
|
||||
KubernetesServiceInstance fooServiceInstance = new KubernetesServiceInstance(
|
||||
"foo", "foo", fooEndpointAddress.getIp(), fooEndpointPort.getPort(), metadata, false);
|
||||
"foo", "foo", fooEndpointAddress.getIp(), fooEndpointPort.getPort(),
|
||||
metadata, false);
|
||||
instances.add(fooServiceInstance);
|
||||
when(reactiveDiscoveryClient.getInstances(eq("foo")))
|
||||
.thenReturn(Flux.fromIterable(instances));
|
||||
|
||||
@@ -47,10 +47,12 @@ import static io.specto.hoverfly.junit.dsl.ResponseCreators.success;
|
||||
@ExtendWith(HoverflyExtension.class)
|
||||
class LoadBalancerWithServiceTests {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(LoadBalancerWithServiceTests.class);
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(LoadBalancerWithServiceTests.class);
|
||||
|
||||
@Autowired
|
||||
RestTemplate restTemplate;
|
||||
|
||||
@Autowired
|
||||
KubernetesClient client;
|
||||
|
||||
@@ -70,9 +72,8 @@ class LoadBalancerWithServiceTests {
|
||||
hoverfly.simulate(
|
||||
dsl(service("http://service-a.test.svc.cluster.local:8080")
|
||||
.get("/greeting").willReturn(success().body("greeting"))),
|
||||
dsl(service(client.getConfiguration().getMasterUrl()
|
||||
.replace("/", "")
|
||||
.replace("https:", ""))
|
||||
dsl(service(client.getConfiguration().getMasterUrl().replace("/", "")
|
||||
.replace("https:", ""))
|
||||
.get("/api/v1/namespaces/test/services/service-a")
|
||||
.willReturn(success().body(
|
||||
json(buildService("service-a", 8080, "test"))))));
|
||||
|
||||
Reference in New Issue
Block a user