From c26bcacc8ebd49cb9432cf3dff4792cf87b113a8 Mon Sep 17 00:00:00 2001 From: James Netherton Date: Wed, 8 Jan 2025 13:17:36 +0000 Subject: [PATCH] CAMEL-21509: Upgrade kubernetes-client to 7.0.1 --- components/camel-kubernetes/pom.xml | 32 +------------------ .../client/ConfigFluentImplConfigurer.java | 3 -- .../KubernetesDeploymentsProducer.java | 2 +- ...ernetesReplicationControllersProducer.java | 2 +- .../OpenshiftDeploymentConfigsProducer.java | 2 +- .../cluster/utils/LockTestServer.java | 11 ++++--- .../KubernetesEventsConsumerIT.java | 6 ++++ .../camel-jbang-plugin-kubernetes/pom.xml | 14 +------- .../traits/knative/KnativeTrait.java | 8 ++--- .../kubernetes/KubernetesBaseTest.java | 2 +- parent/pom.xml | 4 +-- 11 files changed, 23 insertions(+), 63 deletions(-) diff --git a/components/camel-kubernetes/pom.xml b/components/camel-kubernetes/pom.xml index 1f7e5e30f9482..29b37fce1f093 100644 --- a/components/camel-kubernetes/pom.xml +++ b/components/camel-kubernetes/pom.xml @@ -34,23 +34,6 @@ - - - - io.fabric8 - mockwebserver - ${mockwebserver-version} - test - - - com.sun - tools - - - - - - org.apache.camel @@ -85,16 +68,10 @@ ${kubernetes-client-version} test - - io.fabric8 - openshift-server-mock - ${kubernetes-client-version} - test - io.fabric8 mockwebserver - ${mockwebserver-version} + ${kubernetes-client-version} test @@ -128,13 +105,6 @@ ${awaitility-version} test - - - com.squareup.okhttp3 - okhttp - ${squareup-okhttp-version} - test - diff --git a/components/camel-kubernetes/src/generated/java/io/fabric8/kubernetes/client/ConfigFluentImplConfigurer.java b/components/camel-kubernetes/src/generated/java/io/fabric8/kubernetes/client/ConfigFluentImplConfigurer.java index d77f19de01d6e..c0c290a948b3b 100644 --- a/components/camel-kubernetes/src/generated/java/io/fabric8/kubernetes/client/ConfigFluentImplConfigurer.java +++ b/components/camel-kubernetes/src/generated/java/io/fabric8/kubernetes/client/ConfigFluentImplConfigurer.java @@ -56,7 +56,6 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj case "customHeaders": target.withCustomHeaders(property(camelContext, java.util.Map.class, value)); return true; case "disablehostnameverification": case "disableHostnameVerification": target.withDisableHostnameVerification(property(camelContext, java.lang.Boolean.class, value)); return true; - case "file": target.withFile(property(camelContext, java.io.File.class, value)); return true; case "http2disable": case "http2Disable": target.withHttp2Disable(property(camelContext, java.lang.Boolean.class, value)); return true; case "httpproxy": @@ -162,7 +161,6 @@ public Class getOptionType(String name, boolean ignoreCase) { case "customHeaders": return java.util.Map.class; case "disablehostnameverification": case "disableHostnameVerification": return java.lang.Boolean.class; - case "file": return java.io.File.class; case "http2disable": case "http2Disable": return java.lang.Boolean.class; case "httpproxy": @@ -269,7 +267,6 @@ public Object getOptionValue(Object obj, String name, boolean ignoreCase) { case "customHeaders": return target.getCustomHeaders(); case "disablehostnameverification": case "disableHostnameVerification": return target.getDisableHostnameVerification(); - case "file": return target.getFile(); case "http2disable": case "http2Disable": return target.getHttp2Disable(); case "httpproxy": diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/deployments/KubernetesDeploymentsProducer.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/deployments/KubernetesDeploymentsProducer.java index d39b5524ff356..b851fbdb87611 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/deployments/KubernetesDeploymentsProducer.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/deployments/KubernetesDeploymentsProducer.java @@ -204,7 +204,7 @@ protected void doScaleDeployment(Exchange exchange) { throw new IllegalArgumentException("Scale a specific deployment require specify a replicas number"); } Deployment deploymentScaled = getEndpoint().getKubernetesClient().apps().deployments().inNamespace(namespaceName) - .withName(deploymentName).scale(replicasNumber, false); + .withName(deploymentName).scale(replicasNumber); prepareOutboundMessage(exchange, deploymentScaled.getStatus().getReplicas()); } diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/KubernetesReplicationControllersProducer.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/KubernetesReplicationControllersProducer.java index 063a8fde2a5b2..5352d47359806 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/KubernetesReplicationControllersProducer.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/KubernetesReplicationControllersProducer.java @@ -229,7 +229,7 @@ protected void doScaleReplicationController(Exchange exchange) { throw new IllegalArgumentException("Scale a specific replication controller require specify a replicas number"); } ReplicationController rcScaled = getEndpoint().getKubernetesClient().replicationControllers().inNamespace(namespaceName) - .withName(rcName).scale(replicasNumber, false); + .withName(rcName).scale(replicasNumber); prepareOutboundMessage(exchange, rcScaled.getStatus().getReplicas()); } diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/openshift/deploymentconfigs/OpenshiftDeploymentConfigsProducer.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/openshift/deploymentconfigs/OpenshiftDeploymentConfigsProducer.java index 078de1a81e75a..ef588d2aedbb6 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/openshift/deploymentconfigs/OpenshiftDeploymentConfigsProducer.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/openshift/deploymentconfigs/OpenshiftDeploymentConfigsProducer.java @@ -199,7 +199,7 @@ protected void doScaleDeploymentConfig(Exchange exchange) { DeploymentConfig deploymentConfigScaled = getEndpoint().getKubernetesClient().adapt(OpenShiftClient.class).deploymentConfigs() .inNamespace(namespaceName) - .withName(deploymentName).scale(replicasNumber, false); + .withName(deploymentName).scale(replicasNumber); prepareOutboundMessage(exchange, deploymentConfigScaled.getStatus().getReplicas()); } diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cluster/utils/LockTestServer.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cluster/utils/LockTestServer.java index 4abcf11e788a1..56d4f1e276d52 100644 --- a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cluster/utils/LockTestServer.java +++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/cluster/utils/LockTestServer.java @@ -33,9 +33,9 @@ import io.fabric8.kubernetes.client.NamespacedKubernetesClient; import io.fabric8.kubernetes.client.RequestConfig; import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; +import io.fabric8.mockwebserver.http.Headers; +import io.fabric8.mockwebserver.http.RecordedRequest; import io.fabric8.mockwebserver.utils.ResponseProvider; -import okhttp3.Headers; -import okhttp3.mockwebserver.RecordedRequest; import org.apache.camel.RuntimeCamelException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -132,7 +132,7 @@ public int getStatusCode(RecordedRequest request) { boolean done = lockSimulator.setResource(resource, true); if (done) { - lockNames.put(request.getSequenceNumber(), lockSimulator.getResourceName()); + lockNames.put(LockTestServer.super.getRequestCount(), lockSimulator.getResourceName()); return 201; } return 500; @@ -142,8 +142,9 @@ public int getStatusCode(RecordedRequest request) { public Object getBody(RecordedRequest recordedRequest) { delayIfNecessary(); - if (lockNames.containsKey(recordedRequest.getSequenceNumber())) { - T resource = simulators.get(lockNames.get(recordedRequest.getSequenceNumber())).getResource(); + if (lockNames.containsKey(LockTestServer.super.getRequestCount())) { + T resource + = simulators.get(lockNames.get(LockTestServer.super.getRequestCount())).getResource(); if (resource != null) { return resource; } diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/integration/KubernetesEventsConsumerIT.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/integration/KubernetesEventsConsumerIT.java index bafac3732e86f..ce98f445f3e47 100644 --- a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/integration/KubernetesEventsConsumerIT.java +++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/integration/KubernetesEventsConsumerIT.java @@ -31,6 +31,7 @@ import org.apache.camel.component.kubernetes.KubernetesConstants; import org.apache.camel.component.kubernetes.KubernetesTestSupport; import org.apache.camel.component.mock.MockEndpoint; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -57,6 +58,11 @@ public class KubernetesEventsConsumerIT extends KubernetesTestSupport { @EndpointInject("mock:result") protected MockEndpoint mockResultEndpoint; + @BeforeEach + void beforeEach() { + MockEndpoint.resetMocks(context); + } + private void setupFullEventWithHeaders(Exchange exchange) { exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, "default"); exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_EVENT_NAME, "test"); diff --git a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/pom.xml b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/pom.xml index 787409a21212f..33117ab8e6f73 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/pom.xml +++ b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/pom.xml @@ -47,18 +47,6 @@ camel-jbang-core - - - org.bouncycastle - bcprov-jdk18on - ${bouncycastle-version} - - - org.bouncycastle - bcpkix-jdk18on - ${bouncycastle-version} - - io.fabric8 @@ -77,7 +65,7 @@ io.fabric8 knative-model - ${knative-client-version} + ${kubernetes-client-version} diff --git a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/knative/KnativeTrait.java b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/knative/KnativeTrait.java index 3935597dc9e8b..f83d226259507 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/knative/KnativeTrait.java +++ b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/knative/KnativeTrait.java @@ -30,13 +30,13 @@ import java.util.stream.Collectors; import com.fasterxml.jackson.core.JsonProcessingException; +import io.fabric8.knative.duck.v1.DestinationBuilder; +import io.fabric8.knative.duck.v1.KReference; +import io.fabric8.knative.duck.v1.KReferenceBuilder; import io.fabric8.knative.eventing.v1.TriggerBuilder; import io.fabric8.knative.eventing.v1.TriggerFilterBuilder; -import io.fabric8.knative.internal.pkg.apis.duck.v1.DestinationBuilder; -import io.fabric8.knative.internal.pkg.apis.duck.v1.KReference; -import io.fabric8.knative.internal.pkg.apis.duck.v1.KReferenceBuilder; -import io.fabric8.knative.internal.pkg.tracker.ReferenceBuilder; import io.fabric8.knative.messaging.v1.SubscriptionBuilder; +import io.fabric8.knative.pkg.tracker.ReferenceBuilder; import io.fabric8.knative.sources.v1.SinkBindingBuilder; import org.apache.camel.RuntimeCamelException; import org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesHelper; diff --git a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesBaseTest.java b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesBaseTest.java index 5c70b0c9944cf..fe22301011687 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesBaseTest.java +++ b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesBaseTest.java @@ -26,7 +26,7 @@ import io.fabric8.kubernetes.client.server.mock.KubernetesCrudDispatcher; import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; import io.fabric8.mockwebserver.Context; -import okhttp3.mockwebserver.MockWebServer; +import io.fabric8.mockwebserver.MockWebServer; import org.apache.camel.dsl.jbang.core.common.CommandLineHelper; import org.apache.camel.dsl.jbang.core.common.PluginHelper; import org.apache.camel.dsl.jbang.core.common.PluginType; diff --git a/parent/pom.xml b/parent/pom.xml index e5ecc099e669d..489d898352175 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -316,8 +316,7 @@ 2.7.4 1.1.3 3.8.1 - 6.13.4 - 6.13.4 + 7.0.1 1.17.1 0.36.2 1.8 @@ -368,7 +367,6 @@ 0.9.5 8.5.15 1.9 - 6.13.4 5.15.2 2.4.0 5.2.1