From 2fbd04a8e8c11bebc393f991f3175c90b47a491e Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Tue, 11 Jan 2022 16:35:09 +1000 Subject: [PATCH] Kubernetes 14 (#3263) * update to 7.0.1 and change package names Signed-off-by: Sally MacFarlane * Updating packages of our kubernates imports Signed-off-by: Jiri Peinlich * Updating kubernates client verion to 14.0 Signed-off-by: Jiri Peinlich Signed-off-by: Sally MacFarlane * added cddl with classpath extension as an alias Signed-off-by: Sally MacFarlane * get rid of builders Signed-off-by: Sally MacFarlane Co-authored-by: Jiri Peinlich --- gradle/check-licenses.gradle | 1 + gradle/versions.gradle | 2 +- .../nat/kubernetes/KubernetesNatManager.java | 11 +++++----- .../service/LoadBalancerBasedDetector.java | 4 ++-- .../KubernetesClusterIpNatManagerTest.java | 8 ++++---- .../KubernetesLoadManagerNatManagerTest.java | 20 +++++++++---------- .../KubernetesUnknownNatManagerTest.java | 6 +++--- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/gradle/check-licenses.gradle b/gradle/check-licenses.gradle index 04a667dd19..d016505d55 100644 --- a/gradle/check-licenses.gradle +++ b/gradle/check-licenses.gradle @@ -116,6 +116,7 @@ downloadLicenses { 'CDDL 1.0', 'CDDL 1.1', 'Common Development and Distribution License (CDDL) v1.0', + 'CDDL + GPLv2 with classpath exception', ], (epl1) : [ 'Eclipse Public License - Version 1.0', diff --git a/gradle/versions.gradle b/gradle/versions.gradle index 943120566e..7e0dc58964 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -65,7 +65,7 @@ dependencyManagement { dependency 'io.jaegertracing:jaeger-client:1.6.0' - dependency 'io.kubernetes:client-java:6.0.1' + dependency 'io.kubernetes:client-java:14.0.0' dependency 'io.netty:netty-all:4.1.72.Final' dependency 'io.netty:netty-tcnative-boringssl-static:2.0.46.Final' diff --git a/nat/src/main/java/org/hyperledger/besu/nat/kubernetes/KubernetesNatManager.java b/nat/src/main/java/org/hyperledger/besu/nat/kubernetes/KubernetesNatManager.java index e7c6566e44..5828335f45 100644 --- a/nat/src/main/java/org/hyperledger/besu/nat/kubernetes/KubernetesNatManager.java +++ b/nat/src/main/java/org/hyperledger/besu/nat/kubernetes/KubernetesNatManager.java @@ -32,10 +32,10 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; import com.google.common.annotations.VisibleForTesting; -import io.kubernetes.client.ApiClient; -import io.kubernetes.client.Configuration; -import io.kubernetes.client.apis.CoreV1Api; -import io.kubernetes.client.models.V1Service; +import io.kubernetes.client.openapi.ApiClient; +import io.kubernetes.client.openapi.Configuration; +import io.kubernetes.client.openapi.apis.CoreV1Api; +import io.kubernetes.client.openapi.models.V1Service; import io.kubernetes.client.util.ClientBuilder; import io.kubernetes.client.util.KubeConfig; import io.kubernetes.client.util.authenticators.GCPAuthenticator; @@ -78,7 +78,8 @@ public class KubernetesNatManager extends AbstractNatManager { // invokes the CoreV1Api client final V1Service service = api - .listServiceForAllNamespaces(null, null, null, null, null, null, null, null) + .listServiceForAllNamespaces( + null, null, null, null, null, null, null, null, null, null) .getItems() .stream() .filter( diff --git a/nat/src/main/java/org/hyperledger/besu/nat/kubernetes/service/LoadBalancerBasedDetector.java b/nat/src/main/java/org/hyperledger/besu/nat/kubernetes/service/LoadBalancerBasedDetector.java index 8807bd7e97..0768cddcc3 100644 --- a/nat/src/main/java/org/hyperledger/besu/nat/kubernetes/service/LoadBalancerBasedDetector.java +++ b/nat/src/main/java/org/hyperledger/besu/nat/kubernetes/service/LoadBalancerBasedDetector.java @@ -20,8 +20,8 @@ import org.hyperledger.besu.nat.core.exception.NatInitializationException; import java.net.InetAddress; import java.util.Optional; -import io.kubernetes.client.models.V1LoadBalancerIngress; -import io.kubernetes.client.models.V1Service; +import io.kubernetes.client.openapi.models.V1LoadBalancerIngress; +import io.kubernetes.client.openapi.models.V1Service; public class LoadBalancerBasedDetector implements IpDetector { diff --git a/nat/src/test/java/org/hyperledger/besu/nat/kubernetes/KubernetesClusterIpNatManagerTest.java b/nat/src/test/java/org/hyperledger/besu/nat/kubernetes/KubernetesClusterIpNatManagerTest.java index 2065510ea7..2164c172d1 100644 --- a/nat/src/test/java/org/hyperledger/besu/nat/kubernetes/KubernetesClusterIpNatManagerTest.java +++ b/nat/src/test/java/org/hyperledger/besu/nat/kubernetes/KubernetesClusterIpNatManagerTest.java @@ -29,10 +29,10 @@ import java.util.Arrays; import java.util.concurrent.ExecutionException; import io.kubernetes.client.custom.IntOrString; -import io.kubernetes.client.models.V1ObjectMeta; -import io.kubernetes.client.models.V1Service; -import io.kubernetes.client.models.V1ServicePort; -import io.kubernetes.client.models.V1ServiceSpec; +import io.kubernetes.client.openapi.models.V1ObjectMeta; +import io.kubernetes.client.openapi.models.V1Service; +import io.kubernetes.client.openapi.models.V1ServicePort; +import io.kubernetes.client.openapi.models.V1ServiceSpec; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/nat/src/test/java/org/hyperledger/besu/nat/kubernetes/KubernetesLoadManagerNatManagerTest.java b/nat/src/test/java/org/hyperledger/besu/nat/kubernetes/KubernetesLoadManagerNatManagerTest.java index a997041aa9..931d13ffbc 100644 --- a/nat/src/test/java/org/hyperledger/besu/nat/kubernetes/KubernetesLoadManagerNatManagerTest.java +++ b/nat/src/test/java/org/hyperledger/besu/nat/kubernetes/KubernetesLoadManagerNatManagerTest.java @@ -29,13 +29,13 @@ import java.util.Arrays; import java.util.concurrent.ExecutionException; import io.kubernetes.client.custom.IntOrString; -import io.kubernetes.client.models.V1LoadBalancerIngressBuilder; -import io.kubernetes.client.models.V1LoadBalancerStatusBuilder; -import io.kubernetes.client.models.V1ObjectMeta; -import io.kubernetes.client.models.V1Service; -import io.kubernetes.client.models.V1ServicePort; -import io.kubernetes.client.models.V1ServiceSpec; -import io.kubernetes.client.models.V1ServiceStatus; +import io.kubernetes.client.openapi.models.V1LoadBalancerIngress; +import io.kubernetes.client.openapi.models.V1LoadBalancerStatus; +import io.kubernetes.client.openapi.models.V1ObjectMeta; +import io.kubernetes.client.openapi.models.V1Service; +import io.kubernetes.client.openapi.models.V1ServicePort; +import io.kubernetes.client.openapi.models.V1ServiceSpec; +import io.kubernetes.client.openapi.models.V1ServiceStatus; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -59,10 +59,8 @@ public final class KubernetesLoadManagerNatManagerTest { final V1ServiceStatus v1ServiceStatus = new V1ServiceStatus() .loadBalancer( - new V1LoadBalancerStatusBuilder() - .addToIngress( - new V1LoadBalancerIngressBuilder().withIp(detectedAdvertisedHost).build()) - .build()); + new V1LoadBalancerStatus() + .addIngressItem(new V1LoadBalancerIngress().ip(detectedAdvertisedHost))); when(v1Service.getStatus()).thenReturn(v1ServiceStatus); when(v1Service.getSpec()) .thenReturn( diff --git a/nat/src/test/java/org/hyperledger/besu/nat/kubernetes/KubernetesUnknownNatManagerTest.java b/nat/src/test/java/org/hyperledger/besu/nat/kubernetes/KubernetesUnknownNatManagerTest.java index 47345baa70..e72cadeac5 100644 --- a/nat/src/test/java/org/hyperledger/besu/nat/kubernetes/KubernetesUnknownNatManagerTest.java +++ b/nat/src/test/java/org/hyperledger/besu/nat/kubernetes/KubernetesUnknownNatManagerTest.java @@ -17,9 +17,9 @@ package org.hyperledger.besu.nat.kubernetes; import static org.hyperledger.besu.nat.kubernetes.KubernetesNatManager.DEFAULT_BESU_SERVICE_NAME_FILTER; import static org.mockito.Mockito.when; -import io.kubernetes.client.models.V1ObjectMeta; -import io.kubernetes.client.models.V1Service; -import io.kubernetes.client.models.V1ServiceSpec; +import io.kubernetes.client.openapi.models.V1ObjectMeta; +import io.kubernetes.client.openapi.models.V1Service; +import io.kubernetes.client.openapi.models.V1ServiceSpec; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith;