#562 Adding docs, javadoc + removed unused code

This commit is contained in:
piomin
2020-08-25 14:52:47 +02:00
parent 89fbff829a
commit 5d047a7591
9 changed files with 42 additions and 6 deletions

View File

@@ -0,0 +1,28 @@
== 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
----
====

View File

@@ -33,7 +33,7 @@ import org.springframework.web.client.RestTemplate;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@TestPropertySource(properties = "spring.cloud.kubernetes.discovery.all-namespaces=true")
@EnableKubernetesMockClient(https = true, crud = true)
@EnableKubernetesMockClient(crud = true)
public class LoadBalancerAllNamespacesTests {
@Autowired

View File

@@ -31,7 +31,7 @@ import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.web.client.RestTemplate;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@EnableKubernetesMockClient(https = true, crud = true)
@EnableKubernetesMockClient(crud = true)
public class LoadBalancerTests {
@Autowired
@@ -40,9 +40,6 @@ public class LoadBalancerTests {
@LocalServerPort
int randomServerPort;
// @ClassRule
// public static KubernetesServer server = new KubernetesServer(true, true);
static KubernetesClient client;
@BeforeAll

View File

@@ -24,6 +24,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Kubernetes load balancer auto-configuration.
*
* @author Piotr Minkowski
*/
@Configuration(proxyBeanMethods = false)

View File

@@ -24,7 +24,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
/**
* Kubernetes load balancer client properties.
* Kubernetes load balancer client configuration.
*
* @author Piotr Minkowski
*/

View File

@@ -17,6 +17,8 @@
package org.springframework.cloud.kubernetes.loadbalancer;
/**
* Kubernetes load balancer mode enum.
*
* @author Piotr Minkowski
*/
public enum KubernetesLoadBalancerMode {

View File

@@ -19,6 +19,8 @@ package org.springframework.cloud.kubernetes.loadbalancer;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Kubernetes load balancer client properties.
*
* @author Piotr Minkowski
*/
@ConfigurationProperties(prefix = "spring.cloud.kubernetes.loadbalancer")

View File

@@ -31,6 +31,8 @@ import org.springframework.cloud.kubernetes.discovery.KubernetesDiscoveryPropert
import org.springframework.cloud.kubernetes.discovery.KubernetesServiceInstance;
/**
* Class for mapping Kubernetes Service object into {@link KubernetesServiceInstance}.
*
* @author Piotr Minkowski
*/
public class KubernetesServiceInstanceMapper {

View File

@@ -31,6 +31,9 @@ import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
import org.springframework.core.env.Environment;
/**
* Implementation of {@link ServiceInstanceListSupplier} for load balancer
* in SERVICE mode
*
* @author Piotr Minkowski
*/
public class KubernetesServicesListSupplier implements ServiceInstanceListSupplier {