From 6cee36b64a7f5a14fab7817b3342efc7c655bfd8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Aug 2020 05:38:09 +0000 Subject: [PATCH 1/2] Bump openshift-client from 4.10.3 to 4.11.0 Bumps [openshift-client](https://github.com/fabric8io/kubernetes-client) from 4.10.3 to 4.11.0. - [Release notes](https://github.com/fabric8io/kubernetes-client/releases) - [Changelog](https://github.com/fabric8io/kubernetes-client/blob/master/CHANGELOG.md) - [Commits](https://github.com/fabric8io/kubernetes-client/compare/v4.10.3...v4.11.0) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9d1343f6b7..c26fa438fd 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ io.fabric8 openshift-client - 4.10.3 + 4.11.0 org.apache.commons From 01ac401c1f7f965a412495316784ff8db6ed4995 Mon Sep 17 00:00:00 2001 From: Adam Sandor <10675791+adam-sandor@users.noreply.github.com> Date: Thu, 27 Aug 2020 10:39:33 +0200 Subject: [PATCH 2/2] fix classes moved to new packages and deprecated methods --- .../github/containersolutions/operator/Operator.java | 12 +++++++----- .../operator/IntegrationTestSupport.java | 6 ++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/operator-framework/src/main/java/com/github/containersolutions/operator/Operator.java b/operator-framework/src/main/java/com/github/containersolutions/operator/Operator.java index 47254e67c2..d013a015f3 100644 --- a/operator-framework/src/main/java/com/github/containersolutions/operator/Operator.java +++ b/operator-framework/src/main/java/com/github/containersolutions/operator/Operator.java @@ -5,12 +5,13 @@ import com.github.containersolutions.operator.processing.EventScheduler; import com.github.containersolutions.operator.processing.retry.GenericRetry; import com.github.containersolutions.operator.processing.retry.Retry; -import io.fabric8.kubernetes.api.model.apiextensions.CustomResourceDefinition; +import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition; import io.fabric8.kubernetes.client.CustomResource; import io.fabric8.kubernetes.client.CustomResourceDoneable; import io.fabric8.kubernetes.client.CustomResourceList; import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.dsl.MixedOperation; +import io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext; import io.fabric8.kubernetes.client.dsl.internal.CustomResourceOperationsImpl; import io.fabric8.kubernetes.internal.KubernetesDeserializer; import org.slf4j.Logger; @@ -54,8 +55,8 @@ public void registerController(ResourceController private void registerController(ResourceController controller, boolean watchAllNamespaces, Retry retry, String... targetNamespaces) throws OperatorException { Class resClass = getCustomResourceClass(controller); - CustomResourceDefinition crd = getCustomResourceDefinitionForController(controller); - KubernetesDeserializer.registerCustomKind(getApiVersion(crd), getKind(crd), resClass); + CustomResourceDefinitionContext crd = getCustomResourceDefinitionForController(controller); + KubernetesDeserializer.registerCustomKind(crd.getVersion(), crd.getKind(), resClass); String finalizer = getDefaultFinalizer(controller); MixedOperation client = k8sClient.customResources(crd, resClass, CustomResourceList.class, getCustomResourceDoneableClass(controller)); EventDispatcher eventDispatcher = new EventDispatcher(controller, @@ -85,13 +86,14 @@ private void registerWatches(ResourceController co resClass, targetNamespaces.length == 0 ? "[all/client namespace]" : Arrays.toString(targetNamespaces)); } - private CustomResourceDefinition getCustomResourceDefinitionForController(ResourceController controller) { + private CustomResourceDefinitionContext getCustomResourceDefinitionForController(ResourceController controller) { String crdName = getCrdName(controller); CustomResourceDefinition customResourceDefinition = k8sClient.customResourceDefinitions().withName(crdName).get(); if (customResourceDefinition == null) { throw new OperatorException("Cannot find Custom Resource Definition with name: " + crdName); } - return customResourceDefinition; + CustomResourceDefinitionContext context = CustomResourceDefinitionContext.fromCrd(customResourceDefinition); + return context; } public Map, CustomResourceOperationsImpl> getCustomResourceClients() { diff --git a/operator-framework/src/test/java/com/github/containersolutions/operator/IntegrationTestSupport.java b/operator-framework/src/test/java/com/github/containersolutions/operator/IntegrationTestSupport.java index 36eb27af49..e79606e5c4 100644 --- a/operator-framework/src/test/java/com/github/containersolutions/operator/IntegrationTestSupport.java +++ b/operator-framework/src/test/java/com/github/containersolutions/operator/IntegrationTestSupport.java @@ -6,13 +6,14 @@ import io.fabric8.kubernetes.api.model.Namespace; import io.fabric8.kubernetes.api.model.NamespaceBuilder; import io.fabric8.kubernetes.api.model.ObjectMetaBuilder; -import io.fabric8.kubernetes.api.model.apiextensions.CustomResourceDefinition; +import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition; import io.fabric8.kubernetes.client.CustomResource; import io.fabric8.kubernetes.client.CustomResourceDoneable; import io.fabric8.kubernetes.client.CustomResourceList; import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.dsl.MixedOperation; import io.fabric8.kubernetes.client.dsl.Resource; +import io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext; import io.fabric8.kubernetes.client.utils.Serialization; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,11 +42,12 @@ public void initialize(KubernetesClient k8sClient, ResourceController controller log.info("Initializing integration test in namespace {}", TEST_NAMESPACE); this.k8sClient = k8sClient; CustomResourceDefinition crd = loadCRDAndApplyToCluster(crdPath); + CustomResourceDefinitionContext crdContext = CustomResourceDefinitionContext.fromCrd(crd); this.controller = controller; Class doneableClass = getCustomResourceDoneableClass(controller); Class customResourceClass = getCustomResourceClass(controller); - crOperations = k8sClient.customResources(crd, customResourceClass, CustomResourceList.class, doneableClass); + crOperations = k8sClient.customResources(crdContext, customResourceClass, CustomResourceList.class, doneableClass); if (k8sClient.namespaces().withName(TEST_NAMESPACE).get() == null) { k8sClient.namespaces().create(new NamespaceBuilder()