Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(kubernetes): refactor and upgrade kubernetes java client api…
…s and its relevant dependency during upgrade to spring boot 2.6.x (#6133) While upgrading spring boot 2.6.15 and spring cloud 2021.0.8, encounter below errors in clouddriver-kubernetes module during build and test compilation: ``` > Task :clouddriver-kubernetes:compileTestJava FAILED /clouddriver/clouddriver-kubernetes/src/test/java/com/netflix/spinnaker/clouddriver/kubernetes/artifact/ArtifactReplacerTest.java:33: error: cannot find symbol import io.kubernetes.client.openapi.models.V1ContainerBuilder; ^ symbol: class V1ContainerBuilder location: package io.kubernetes.client.openapi.models /clouddriver/clouddriver-kubernetes/src/test/java/com/netflix/spinnaker/clouddriver/kubernetes/artifact/ArtifactReplacerTest.java:35: error: cannot find symbol import io.kubernetes.client.openapi.models.V1DeploymentBuilder; ^ symbol: class V1DeploymentBuilder location: package io.kubernetes.client.openapi.models /clouddriver/clouddriver-kubernetes/src/test/java/com/netflix/spinnaker/clouddriver/kubernetes/artifact/ArtifactReplacerTest.java:38: error: cannot find symbol import io.kubernetes.client.openapi.models.V1HorizontalPodAutoscalerBuilder; ^ symbol: class V1HorizontalPodAutoscalerBuilder location: package io.kubernetes.client.openapi.models /clouddriver/clouddriver-kubernetes/src/test/java/com/netflix/spinnaker/clouddriver/kubernetes/artifact/ArtifactReplacerTest.java:42: error: cannot find symbol import io.kubernetes.client.openapi.models.V1ReplicaSetBuilder; ^ symbol: class V1ReplicaSetBuilder location: package io.kubernetes.client.openapi.models 4 errors ``` ``` > Task :clouddriver-kubernetes:compileJava FAILED /clouddriver/clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/provider/view/KubernetesJobProvider.java:38: error: package org.joda.time does not exist import org.joda.time.DateTime; ^ 1 error ``` ``` /clouddriver/clouddriver-kubernetes/src/main/java/com/netflix/spinnaker/clouddriver/kubernetes/model/KubernetesJobStatus.java:71: error: cannot find symbol this.createdTime = job.getMetadata().getCreationTimestamp().getMillis(); ^ symbol: method getMillis() location: class OffsetDateTime ``` First issue is due to upgrade in kubernetes java client from 11.0.4 to [13.0.2](https://github.com/kubernetes-client/java/blob/master/CHANGELOG.md#1300) brought by spring cloud upgrade to 2021.0.8, which add separate fluent builder classes (and also its generator) to new modules client-java-api-fluent and client-java-api-fluent-gen. https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-dependencies/2021.0.8/spring-cloud-dependencies-2021.0.8.pom https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-kubernetes-dependencies/2.1.8/spring-cloud-kubernetes-dependencies-2.1.8.pom Since these fluent builder module is not part of java client package pom, so adding explicit dependency of `io.kubernetes:client-java-api-fluent` and pinning the required version. Second and third issue is due to change in required parameters, from `DateTime` to `OffsetDateTime`, of kubernetes client apis as part of upgrade like for [V1PodCondition.setLastTransitionTime(OffsetDateTime)](https://javadoc.io/static/io.kubernetes/client-java-api/13.0.2/io/kubernetes/client/openapi/models/V1PodCondition.html#setLastTransitionTime-java.time.OffsetDateTime-). Updating the required parameters in order to fix them. And adding the required package. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information