Bumping versions
This commit is contained in:
12
README.adoc
12
README.adoc
@@ -828,6 +828,7 @@ to `false` in `bootstrap.[properties | yaml]`.
|
||||
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.
|
||||
====
|
||||
Fabric8 Implementation
|
||||
[source,xml]
|
||||
----
|
||||
<dependency>
|
||||
@@ -837,6 +838,17 @@ To include it to your project add the following dependency.
|
||||
----
|
||||
====
|
||||
|
||||
====
|
||||
Kubernetes Java Client Implementation
|
||||
[source,xml]
|
||||
----
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-kubernetes-client-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]
|
||||
|
||||
@@ -25,12 +25,13 @@ public class EndpointsTrimmingStrategy implements ExclusionStrategy {
|
||||
@Override
|
||||
public boolean shouldSkipField(FieldAttributes fieldAttributes) {
|
||||
// trimming field-managers
|
||||
return V1ObjectMeta.class.equals(fieldAttributes.getDeclaringClass()) &&
|
||||
"managedFields".equals(fieldAttributes.getName());
|
||||
return V1ObjectMeta.class.equals(fieldAttributes.getDeclaringClass())
|
||||
&& "managedFields".equals(fieldAttributes.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSkipClass(Class<?> aClass) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,12 +27,13 @@ public class ServiceTrimmingStrategy implements ExclusionStrategy {
|
||||
@Override
|
||||
public boolean shouldSkipField(FieldAttributes fieldAttributes) {
|
||||
// trimming field-managers
|
||||
return V1ObjectMeta.class.equals(fieldAttributes.getDeclaringClass()) &&
|
||||
"managedFields".equals(fieldAttributes.getName());
|
||||
return V1ObjectMeta.class.equals(fieldAttributes.getDeclaringClass())
|
||||
&& "managedFields".equals(fieldAttributes.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSkipClass(Class<?> aClass) {
|
||||
return V1ServiceSpec.class.equals(aClass) || V1ServiceStatus.class.equals(aClass);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,8 +34,7 @@ public class EndpointsTrimmingStrategyTests {
|
||||
@Test
|
||||
public void testDeserializingEndpoints() {
|
||||
|
||||
V1ObjectMeta meta =
|
||||
new V1ObjectMeta().name("foo")
|
||||
V1ObjectMeta meta = new V1ObjectMeta().name("foo")
|
||||
.managedFields(Collections.singletonList(new V1ManagedFieldsEntry()));
|
||||
|
||||
V1Endpoints input = new V1Endpoints().metadata(meta);
|
||||
@@ -63,4 +62,5 @@ public class EndpointsTrimmingStrategyTests {
|
||||
Assert.assertEquals("foo", deserializedMeta.getName());
|
||||
Assert.assertEquals("cluster", deserializedMeta.getClusterName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -57,9 +57,8 @@ public class ServiceTrimmingStrategyTests {
|
||||
// "V1ObjectMeta" is present and has "managedFields"
|
||||
@Test
|
||||
public void testV1ObjectMetaWithoutManagedFieldsIsSkipped() {
|
||||
V1ObjectMeta meta = new V1ObjectMeta()
|
||||
.name("foo")
|
||||
.managedFields(Collections.singletonList(new V1ManagedFieldsEntry()));
|
||||
V1ObjectMeta meta = new V1ObjectMeta().name("foo")
|
||||
.managedFields(Collections.singletonList(new V1ManagedFieldsEntry()));
|
||||
|
||||
V1Service service = new V1Service().metadata(meta).kind("service");
|
||||
|
||||
@@ -79,20 +78,16 @@ public class ServiceTrimmingStrategyTests {
|
||||
@Test
|
||||
public void testDeserializingService() {
|
||||
|
||||
V1ObjectMeta meta =
|
||||
new V1ObjectMeta().name("foo")
|
||||
V1ObjectMeta meta = new V1ObjectMeta().name("foo")
|
||||
.managedFields(Collections.singletonList(new V1ManagedFieldsEntry()));
|
||||
|
||||
V1LoadBalancerStatus balancerStatus =
|
||||
new V1LoadBalancerStatus().addIngressItem(new V1LoadBalancerIngress().ip("2.2.2.2"));
|
||||
V1LoadBalancerStatus balancerStatus = new V1LoadBalancerStatus()
|
||||
.addIngressItem(new V1LoadBalancerIngress().ip("2.2.2.2"));
|
||||
|
||||
V1ServiceStatus serviceStatus = new V1ServiceStatus().loadBalancer(balancerStatus);
|
||||
V1ServiceSpec serviceSpec = new V1ServiceSpec().loadBalancerIP("1.1.1.1");
|
||||
|
||||
V1Service input = new V1Service()
|
||||
.metadata(meta)
|
||||
.spec(serviceSpec)
|
||||
.status(serviceStatus);
|
||||
V1Service input = new V1Service().metadata(meta).spec(serviceSpec).status(serviceStatus);
|
||||
|
||||
String data = GSON.toJson(input);
|
||||
V1Service output = GSON.fromJson(data, V1Service.class);
|
||||
@@ -106,4 +101,5 @@ public class ServiceTrimmingStrategyTests {
|
||||
// managed-fields should be excluded
|
||||
Assert.assertNull(metadata.getManagedFields());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user