diff --git a/CHANGELOG.md b/CHANGELOG.md index 97b1411fe53..4ac6de18e67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ #### New Features #### _**Note**_: Breaking changes in the API +* Refactoring #3654: + * Removed deprecated KubernetesClient.customResource / RawCustomResourceOperationsImpl, please use the generic resource api instead + * Removed deprecatedHttpClientUtils.createHttpClient(final Config config, final Consumer additionalConfig), please use the OkHttpClientFactory instead + * Removed deprecated methods on SharedInformerFactory dealing with the OperationContext +* Refactoring #2838: Readiness/OpenShiftReadiness moved from client.internal.readiness to client.readiness ### 5.12.1 (2022-02-04) diff --git a/doc/MIGRATION-v6.md b/doc/MIGRATION-v6.md index 14b686ba4c6..0bd4b0d4cac 100644 --- a/doc/MIGRATION-v6.md +++ b/doc/MIGRATION-v6.md @@ -1,8 +1,29 @@ # Migration from 5.x to 6.x ## Contents: +- [API/Impl split](#api-impl-split) +- [Deprecation Removals](#deprecation-removals) - [IntOrString changes](#intorstring-changes) +## API/Impl split + +This release introduces kubernetes-client-api and openshift-client-api modules. You may use them as compile dependencies in your application with the respective kubernetes-client and openshift-client as runtime dependencies. This will keep you compile classpath cleaner of classes and libraries that are not intentionally exposed by the fabric8 client. + +If you are directly relying on classes in the -client jars other than DefaultKubernetesClient and DefaultOpenShiftClient, please let us know your usage scenario. Moving forward we'd like consider all classes in the -client jars internal. + +When you rely solely on a compile dependency to the respective -api dependencies you will not be able to use DefaultKubernetesClient nor DefaultOpenShiftClient directly to create your client instances. You should instead - TBD + +### Package Changes + +- Readiness/OpenShiftReadiness moved from client.internal.readiness to client.readiness +- client.utils classes including Base64, CreateOrReplaceHelper, DeleteOrCreateHelper, OptionalDendencyWrapper, etc. are not in the -api jar, they are still in the -client jar under utils.internal. +- Some other effectively internal classes in dsl.base and other packages were moved to corresponding internal packages - it is unlikely this will affect you unless you developed a custom extension. + +## Deprecation Removals + +- Removed KubernetesClient.customResource / RawCustomResourceOperationsImpl, please use the generic resource api instead +- Removed deprecatedHttpClientUtils.createHttpClient(final Config config, final Consumer additionalConfig), please use the OkHttpClientFactory instead +- Removed deprecated methods on SharedInformerFactory dealing with the OperationContext ## IntOrString changes diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/Config.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/Config.java index ad441a06b3e..c16eac8135a 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/Config.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/Config.java @@ -32,7 +32,7 @@ import io.fabric8.kubernetes.client.internal.CertUtils; import io.fabric8.kubernetes.client.internal.KubeConfigUtils; import io.fabric8.kubernetes.client.internal.SSLUtils; -import io.fabric8.kubernetes.client.internal.readiness.Readiness; +import io.fabric8.kubernetes.client.readiness.Readiness; import io.fabric8.kubernetes.client.utils.IOHelpers; import io.fabric8.kubernetes.client.utils.Serialization; import io.fabric8.kubernetes.client.utils.Utils; diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/internal/readiness/Readiness.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/readiness/Readiness.java similarity index 99% rename from kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/internal/readiness/Readiness.java rename to kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/readiness/Readiness.java index 9a6b52331f2..181b21cc512 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/internal/readiness/Readiness.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/readiness/Readiness.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.fabric8.kubernetes.client.internal.readiness; +package io.fabric8.kubernetes.client.readiness; import io.fabric8.kubernetes.api.model.EndpointSubset; import io.fabric8.kubernetes.api.model.Endpoints; diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesResourceUtil.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesResourceUtil.java index c054051f0a3..490f1ecbd3c 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesResourceUtil.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesResourceUtil.java @@ -29,7 +29,7 @@ import io.fabric8.kubernetes.api.model.Secret; import io.fabric8.kubernetes.api.model.SecretBuilder; import io.fabric8.kubernetes.client.CustomResourceList; -import io.fabric8.kubernetes.client.internal.readiness.Readiness; +import io.fabric8.kubernetes.client.readiness.Readiness; import java.nio.charset.StandardCharsets; import java.time.Duration; diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/PodStatusUtil.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/PodStatusUtil.java index e58a73c7e32..59c1305e3c7 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/PodStatusUtil.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/PodStatusUtil.java @@ -20,7 +20,7 @@ import io.fabric8.kubernetes.api.model.ContainerStatus; import io.fabric8.kubernetes.api.model.Pod; import io.fabric8.kubernetes.api.model.PodStatus; -import io.fabric8.kubernetes.client.internal.readiness.Readiness; +import io.fabric8.kubernetes.client.readiness.Readiness; import java.util.Collections; import java.util.List; diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/readiness/ReadinessTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/readiness/ReadinessTest.java similarity index 96% rename from kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/readiness/ReadinessTest.java rename to kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/readiness/ReadinessTest.java index 942ae94f472..5b088ba4e12 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/readiness/ReadinessTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/readiness/ReadinessTest.java @@ -13,12 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.fabric8.kubernetes.client.internal.readiness; +package io.fabric8.kubernetes.client.readiness; import io.fabric8.kubernetes.api.model.ServiceBuilder; import io.fabric8.kubernetes.api.model.apps.StatefulSet; import io.fabric8.kubernetes.api.model.apps.StatefulSetSpec; import io.fabric8.kubernetes.api.model.apps.StatefulSetStatus; +import io.fabric8.kubernetes.client.readiness.Readiness; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/BaseOperation.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/BaseOperation.java index efa7bc0fd97..42d4e81a089 100755 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/BaseOperation.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/BaseOperation.java @@ -55,7 +55,7 @@ import io.fabric8.kubernetes.client.informers.ResourceEventHandler; import io.fabric8.kubernetes.client.informers.SharedIndexInformer; import io.fabric8.kubernetes.client.informers.impl.DefaultSharedIndexInformer; -import io.fabric8.kubernetes.client.internal.readiness.Readiness; +import io.fabric8.kubernetes.client.readiness.Readiness; import io.fabric8.kubernetes.client.utils.URLUtils; import io.fabric8.kubernetes.client.utils.URLUtils.URLBuilder; import io.fabric8.kubernetes.client.utils.Utils; diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.java index a50d9f03b51..cc821ee3125 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableImpl.java @@ -41,7 +41,7 @@ import io.fabric8.kubernetes.client.dsl.Waitable; import io.fabric8.kubernetes.client.dsl.base.HasMetadataOperation; import io.fabric8.kubernetes.client.dsl.base.OperationContext; -import io.fabric8.kubernetes.client.internal.readiness.Readiness; +import io.fabric8.kubernetes.client.readiness.Readiness; import io.fabric8.kubernetes.client.utils.KubernetesResourceUtil; import java.util.Arrays; diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.java index e2553d0f1dc..b931dd2b58a 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.java @@ -30,7 +30,7 @@ import io.fabric8.kubernetes.client.dsl.base.HasMetadataOperation; import io.fabric8.kubernetes.client.dsl.base.OperationContext; import io.fabric8.kubernetes.client.http.HttpClient; -import io.fabric8.kubernetes.client.internal.readiness.Readiness; +import io.fabric8.kubernetes.client.readiness.Readiness; import io.fabric8.kubernetes.client.utils.Serialization; import io.fabric8.kubernetes.client.utils.Utils; import org.slf4j.Logger; diff --git a/kubernetes-itests/src/test/java/io/fabric8/kubernetes/DeploymentIT.java b/kubernetes-itests/src/test/java/io/fabric8/kubernetes/DeploymentIT.java index 9450ae9fd00..9b4f2f7ee84 100644 --- a/kubernetes-itests/src/test/java/io/fabric8/kubernetes/DeploymentIT.java +++ b/kubernetes-itests/src/test/java/io/fabric8/kubernetes/DeploymentIT.java @@ -23,7 +23,7 @@ import io.fabric8.kubernetes.api.model.apps.DeploymentBuilder; import io.fabric8.kubernetes.api.model.apps.DeploymentList; import io.fabric8.kubernetes.client.KubernetesClient; -import io.fabric8.kubernetes.client.internal.readiness.Readiness; +import io.fabric8.kubernetes.client.readiness.Readiness; import org.arquillian.cube.kubernetes.api.Session; import org.arquillian.cube.kubernetes.impl.requirement.RequiresKubernetes; import org.arquillian.cube.requirement.ArquillianConditionalRunner; diff --git a/kubernetes-itests/src/test/java/io/fabric8/kubernetes/PodIT.java b/kubernetes-itests/src/test/java/io/fabric8/kubernetes/PodIT.java index 2b23438b001..540aa5ad697 100644 --- a/kubernetes-itests/src/test/java/io/fabric8/kubernetes/PodIT.java +++ b/kubernetes-itests/src/test/java/io/fabric8/kubernetes/PodIT.java @@ -31,7 +31,7 @@ import io.fabric8.kubernetes.client.dsl.ExecListener; import io.fabric8.kubernetes.client.dsl.ExecWatch; import io.fabric8.kubernetes.client.dsl.PodResource; -import io.fabric8.kubernetes.client.internal.readiness.Readiness; +import io.fabric8.kubernetes.client.readiness.Readiness; import io.fabric8.kubernetes.client.utils.IOHelpers; import org.arquillian.cube.kubernetes.api.Session; import org.arquillian.cube.kubernetes.impl.requirement.RequiresKubernetes; diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ResourceTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ResourceTest.java index 6e69a2abebc..db993dff67c 100644 --- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ResourceTest.java +++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ResourceTest.java @@ -35,7 +35,7 @@ import io.fabric8.kubernetes.client.dsl.Applicable; import io.fabric8.kubernetes.client.dsl.NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicable; import io.fabric8.kubernetes.client.dsl.PodResource; -import io.fabric8.kubernetes.client.internal.readiness.Readiness; +import io.fabric8.kubernetes.client.readiness.Readiness; import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient; import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; import io.fabric8.kubernetes.client.utils.Serialization; diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/OpenShiftConfig.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/OpenShiftConfig.java index bfcd8e3678f..b6f1e7a8251 100644 --- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/OpenShiftConfig.java +++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/OpenShiftConfig.java @@ -21,10 +21,10 @@ import io.fabric8.kubernetes.client.Config; import io.fabric8.kubernetes.client.OAuthTokenProvider; import io.fabric8.kubernetes.client.http.TlsVersion; -import io.fabric8.kubernetes.client.internal.readiness.Readiness; +import io.fabric8.kubernetes.client.readiness.Readiness; import io.fabric8.kubernetes.client.utils.URLUtils; import io.fabric8.kubernetes.client.utils.Utils; -import io.fabric8.openshift.client.internal.readiness.OpenShiftReadiness; +import io.fabric8.openshift.client.readiness.OpenShiftReadiness; import io.sundr.builder.annotations.Buildable; import io.sundr.builder.annotations.BuildableReference; diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/internal/readiness/OpenShiftReadiness.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/readiness/OpenShiftReadiness.java similarity index 95% rename from openshift-client-api/src/main/java/io/fabric8/openshift/client/internal/readiness/OpenShiftReadiness.java rename to openshift-client-api/src/main/java/io/fabric8/openshift/client/readiness/OpenShiftReadiness.java index a0e7db59c8e..92cac320927 100644 --- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/internal/readiness/OpenShiftReadiness.java +++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/readiness/OpenShiftReadiness.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.fabric8.openshift.client.internal.readiness; +package io.fabric8.openshift.client.readiness; import io.fabric8.kubernetes.api.model.HasMetadata; -import io.fabric8.kubernetes.client.internal.readiness.Readiness; +import io.fabric8.kubernetes.client.readiness.Readiness; import io.fabric8.kubernetes.client.utils.Utils; import io.fabric8.openshift.api.model.DeploymentConfig; import io.fabric8.openshift.api.model.DeploymentConfigSpec; diff --git a/openshift-client-api/src/test/java/io/fabric8/openshift/client/internal/readiness/OpenShiftReadinessTest.java b/openshift-client-api/src/test/java/io/fabric8/openshift/client/readiness/OpenShiftReadinessTest.java similarity index 93% rename from openshift-client-api/src/test/java/io/fabric8/openshift/client/internal/readiness/OpenShiftReadinessTest.java rename to openshift-client-api/src/test/java/io/fabric8/openshift/client/readiness/OpenShiftReadinessTest.java index d9ea7dea470..849b5bf046b 100644 --- a/openshift-client-api/src/test/java/io/fabric8/openshift/client/internal/readiness/OpenShiftReadinessTest.java +++ b/openshift-client-api/src/test/java/io/fabric8/openshift/client/readiness/OpenShiftReadinessTest.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.fabric8.openshift.client.internal.readiness; +package io.fabric8.openshift.client.readiness; -import io.fabric8.kubernetes.client.internal.readiness.Readiness; +import io.fabric8.kubernetes.client.readiness.Readiness; import io.fabric8.openshift.api.model.DeploymentConfig; import io.fabric8.openshift.api.model.DeploymentConfigBuilder; import io.fabric8.openshift.api.model.ImageStreamBuilder; diff --git a/openshift-client/src/test/java/io/fabric8/openshift/client/internal/readiness/OpenShiftReadinessTest.java b/openshift-client/src/test/java/io/fabric8/openshift/client/internal/readiness/OpenShiftReadinessTest.java deleted file mode 100644 index d9ea7dea470..00000000000 --- a/openshift-client/src/test/java/io/fabric8/openshift/client/internal/readiness/OpenShiftReadinessTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (C) 2015 Red Hat, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.fabric8.openshift.client.internal.readiness; - -import io.fabric8.kubernetes.client.internal.readiness.Readiness; -import io.fabric8.openshift.api.model.DeploymentConfig; -import io.fabric8.openshift.api.model.DeploymentConfigBuilder; -import io.fabric8.openshift.api.model.ImageStreamBuilder; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -class OpenShiftReadinessTest { - - private Readiness readiness; - - @BeforeEach - void setUp() { - readiness = OpenShiftReadiness.getInstance(); - } - - @Test - void testOpenShiftReadinessWithDeploymentConfig() { - DeploymentConfig dc = new DeploymentConfigBuilder() - .withNewSpec().withReplicas(2).endSpec() - .withNewStatus().withAvailableReplicas(2).withReplicas(2).endStatus() - .build(); - - assertTrue(readiness.isReady(dc)); - } - - @Test - void testOpenShiftReadinessWithNonReadinessApplicableResource() { - assertTrue(readiness.isReady(new ImageStreamBuilder().withNewMetadata().withName("is1").endMetadata().build())); - } - - @Test - void testOpenShiftReadinessWithNullResource() { - assertFalse(readiness.isReady(null)); - } -}