Merge pull request #580 from Haybu/upgrade-k8s-client
Upgrade k8s client
This commit is contained in:
@@ -99,8 +99,9 @@ public abstract class ConfigurationChangeDetector {
|
||||
List<? extends MapPropertySource> l2) {
|
||||
|
||||
if (l1.size() != l2.size()) {
|
||||
this.log.warn("The current number of ConfigMap PropertySources does not match "
|
||||
+ "the ones loaded from the Kubernetes - No reload will take place");
|
||||
this.log.warn(
|
||||
"The current number of ConfigMap PropertySources does not match "
|
||||
+ "the ones loaded from the Kubernetes - No reload will take place");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<properties>
|
||||
<arquillian.version>1.4.0.Final</arquillian.version>
|
||||
<arquillian-cube.version>1.15.2</arquillian-cube.version>
|
||||
<kubernetes-client.version>4.4.1</kubernetes-client.version>
|
||||
<kubernetes-client.version>4.10.3</kubernetes-client.version>
|
||||
<istio-client.version>1.0.0</istio-client.version>
|
||||
<mockwebserver.version>0.1.2</mockwebserver.version>
|
||||
<okhttp.version>3.12.0</okhttp.version>
|
||||
|
||||
@@ -69,8 +69,8 @@ public class KubernetesDiscoveryClientTest {
|
||||
Endpoints endPoint = new EndpointsBuilder().withNewMetadata().withName("endpoint")
|
||||
.withNamespace("test").withLabels(labels).endMetadata().addNewSubset()
|
||||
.addNewAddress().withIp("ip1").withNewTargetRef().withUid("10")
|
||||
.endTargetRef().endAddress().addNewPort("http", 80, "TCP").endSubset()
|
||||
.build();
|
||||
.endTargetRef().endAddress().addNewPort("http", "http_tcp", 80, "TCP")
|
||||
.endSubset().build();
|
||||
|
||||
List<Endpoints> endpointsList = new ArrayList<>();
|
||||
endpointsList.add(endPoint);
|
||||
@@ -121,8 +121,8 @@ public class KubernetesDiscoveryClientTest {
|
||||
.withName("endpoint").withNamespace("test").withLabels(labels)
|
||||
.endMetadata().addNewSubset().addNewAddress().withIp("ip1")
|
||||
.withNewTargetRef().withUid("20").endTargetRef().endAddress()
|
||||
.addNewPort("mgmt", 900, "TCP").addNewPort("http", 80, "TCP").endSubset()
|
||||
.build();
|
||||
.addNewPort("mgmt", "mgmt_tcp", 900, "TCP")
|
||||
.addNewPort("http", "http_tcp", 80, "TCP").endSubset().build();
|
||||
|
||||
List<Endpoints> endpointsList = new ArrayList<>();
|
||||
endpointsList.add(endPoint1);
|
||||
@@ -146,7 +146,7 @@ public class KubernetesDiscoveryClientTest {
|
||||
.andReturn(200, service).always();
|
||||
|
||||
final KubernetesDiscoveryProperties properties = new KubernetesDiscoveryProperties();
|
||||
properties.setPrimaryPortName("http");
|
||||
properties.setPrimaryPortName("http_tcp");
|
||||
|
||||
final DiscoveryClient discoveryClient = new KubernetesDiscoveryClient(mockClient,
|
||||
properties, KubernetesClient::services,
|
||||
@@ -168,8 +168,8 @@ public class KubernetesDiscoveryClientTest {
|
||||
Endpoints endPoint = new EndpointsBuilder().withNewMetadata().withName("endpoint")
|
||||
.withNamespace("test").withLabels(labels).endMetadata().addNewSubset()
|
||||
.addNewAddress().withIp("ip1").withNewTargetRef().withUid("30")
|
||||
.endTargetRef().endAddress().addNewPort("http", 80, "TCP").endSubset()
|
||||
.build();
|
||||
.endTargetRef().endAddress().addNewPort("http", "http_tcp", 80, "TCP")
|
||||
.endSubset().build();
|
||||
|
||||
List<Endpoints> endpointsList = new ArrayList<>();
|
||||
endpointsList.add(endPoint);
|
||||
@@ -204,7 +204,7 @@ public class KubernetesDiscoveryClientTest {
|
||||
.addNewAddress().withIp("ip1").withNewTargetRef().withUid("40")
|
||||
.endTargetRef().endAddress().addNewAddress().withIp("ip2")
|
||||
.withNewTargetRef().withUid("50").endTargetRef().endAddress()
|
||||
.addNewPort("https", 443, "TCP").endSubset().build();
|
||||
.addNewPort("https", "https_tcp", 443, "TCP").endSubset().build();
|
||||
|
||||
List<Endpoints> endpointsList = new ArrayList<>();
|
||||
endpointsList.add(endPoint);
|
||||
@@ -306,14 +306,14 @@ public class KubernetesDiscoveryClientTest {
|
||||
Endpoints endPoints1 = new EndpointsBuilder().withNewMetadata()
|
||||
.withName("endpoint").withNamespace("test").endMetadata().addNewSubset()
|
||||
.addNewAddress().withIp("ip1").withNewTargetRef().withUid("60")
|
||||
.endTargetRef().endAddress().addNewPort("http", 80, "TCP").endSubset()
|
||||
.build();
|
||||
.endTargetRef().endAddress().addNewPort("http", "http_tcp", 80, "TCP")
|
||||
.endSubset().build();
|
||||
|
||||
Endpoints endpoints2 = new EndpointsBuilder().withNewMetadata()
|
||||
.withName("endpoint").withNamespace("test2").endMetadata().addNewSubset()
|
||||
.addNewAddress().withIp("ip2").withNewTargetRef().withUid("70")
|
||||
.endTargetRef().endAddress().addNewPort("http", 80, "TCP").endSubset()
|
||||
.build();
|
||||
.endTargetRef().endAddress().addNewPort("http", "http_tcp", 80, "TCP")
|
||||
.endSubset().build();
|
||||
|
||||
List<Endpoints> endpointsList = new ArrayList<>();
|
||||
endpointsList.add(endPoints1);
|
||||
|
||||
@@ -160,8 +160,8 @@ class KubernetesReactiveDiscoveryClientTests {
|
||||
Endpoints endPoints = new EndpointsBuilder().withNewMetadata()
|
||||
.withName("endpoint").withNamespace("test").endMetadata().addNewSubset()
|
||||
.addNewAddress().withIp("ip1").withNewTargetRef().withUid("uid1")
|
||||
.endTargetRef().endAddress().addNewPort("http", 80, "TCP").endSubset()
|
||||
.build();
|
||||
.endTargetRef().endAddress().addNewPort("http", "http_tcp", 80, "TCP")
|
||||
.endSubset().build();
|
||||
|
||||
kubernetesServer.expect().get()
|
||||
.withPath("/api/v1/namespaces/test/endpoints/existing-service")
|
||||
@@ -204,8 +204,8 @@ class KubernetesReactiveDiscoveryClientTests {
|
||||
Endpoints endPoints = new EndpointsBuilder().withNewMetadata()
|
||||
.withName("endpoint").withNamespace("test").endMetadata().addNewSubset()
|
||||
.addNewAddress().withIp("ip1").withNewTargetRef().withUid("uid1")
|
||||
.endTargetRef().endAddress().addNewPort("http", 80, "TCP").endSubset()
|
||||
.build();
|
||||
.endTargetRef().endAddress().addNewPort("http", "http_tcp", 80, "TCP")
|
||||
.endSubset().build();
|
||||
|
||||
kubernetesServer.expect().get()
|
||||
.withPath("/api/v1/namespaces/test/endpoints/existing-service")
|
||||
@@ -251,8 +251,8 @@ class KubernetesReactiveDiscoveryClientTests {
|
||||
Endpoints endPoints = new EndpointsBuilder().withNewMetadata()
|
||||
.withName("endpoint").withNamespace("test").endMetadata().addNewSubset()
|
||||
.addNewAddress().withIp("ip1").withNewTargetRef().withUid("uid1")
|
||||
.endTargetRef().endAddress().addNewPort("http", 80, "TCP")
|
||||
.addNewPort("https", 443, "TCP").endSubset().build();
|
||||
.endTargetRef().endAddress().addNewPort("http", "http_tcp", 80, "TCP")
|
||||
.addNewPort("https", "https_tcp", 443, "TCP").endSubset().build();
|
||||
|
||||
kubernetesServer.expect().get()
|
||||
.withPath("/api/v1/namespaces/test/endpoints/existing-service")
|
||||
@@ -296,8 +296,8 @@ class KubernetesReactiveDiscoveryClientTests {
|
||||
Endpoints endpoints = new EndpointsBuilder().withNewMetadata()
|
||||
.withName("endpoint").withNamespace("test").endMetadata().addNewSubset()
|
||||
.addNewAddress().withIp("ip1").withNewTargetRef().withUid("uid1")
|
||||
.endTargetRef().endAddress().addNewPort("http", 80, "TCP")
|
||||
.addNewPort("https", 443, "TCP").endSubset().build();
|
||||
.endTargetRef().endAddress().addNewPort("http", "http_tcp", 80, "TCP")
|
||||
.addNewPort("https", "https_tcp", 443, "TCP").endSubset().build();
|
||||
|
||||
EndpointsList endpointsList = new EndpointsList();
|
||||
endpointsList.setItems(singletonList(endpoints));
|
||||
|
||||
@@ -100,7 +100,7 @@ public class RibbonFallbackTest {
|
||||
.addNewAddress()
|
||||
.withIp(mockServer.getHostName())
|
||||
.endAddress()
|
||||
.addNewPort("http", mockServer.getPort(), "http")
|
||||
.addNewPort("http", "http_tcp",mockServer.getPort(), "http")
|
||||
.endSubset()
|
||||
.build();
|
||||
// @formatter:on
|
||||
|
||||
@@ -79,19 +79,17 @@ public class RibbonTest {
|
||||
|
||||
// Configured
|
||||
server.expect().get().withPath("/api/v1/namespaces/testns/endpoints/testapp")
|
||||
.andReturn(200,
|
||||
new EndpointsBuilder().withNewMetadata().withName("testapp-a")
|
||||
.endMetadata().addNewSubset().addNewAddress()
|
||||
.withIp(mockEndpointA.getMockServer().getHostName())
|
||||
.endAddress()
|
||||
.addNewPort("http",
|
||||
mockEndpointA.getMockServer().getPort(), "http")
|
||||
.endSubset().addNewSubset().addNewAddress()
|
||||
.withIp(mockEndpointB.getMockServer().getHostName())
|
||||
.endAddress()
|
||||
.addNewPort("http",
|
||||
mockEndpointB.getMockServer().getPort(), "http")
|
||||
.endSubset().build())
|
||||
.andReturn(200, new EndpointsBuilder().withNewMetadata()
|
||||
.withName("testapp-a").endMetadata().addNewSubset()
|
||||
.addNewAddress()
|
||||
.withIp(mockEndpointA.getMockServer().getHostName()).endAddress()
|
||||
.addNewPort("http", "http_tcp",
|
||||
mockEndpointA.getMockServer().getPort(), "http")
|
||||
.endSubset().addNewSubset().addNewAddress()
|
||||
.withIp(mockEndpointB.getMockServer().getHostName()).endAddress()
|
||||
.addNewPort("http", "http_tcp",
|
||||
mockEndpointB.getMockServer().getPort(), "http")
|
||||
.endSubset().build())
|
||||
.always();
|
||||
|
||||
mockEndpointA.expect().get().withPath("/greeting").andReturn(200, "Hello from A")
|
||||
|
||||
Reference in New Issue
Block a user