diff --git a/core/cloudflow-cli/src/main/scala/akka/cli/cloudflow/kubeclient/KubeClientFabric8.scala b/core/cloudflow-cli/src/main/scala/akka/cli/cloudflow/kubeclient/KubeClientFabric8.scala index eef084983..1b4b7ef21 100644 --- a/core/cloudflow-cli/src/main/scala/akka/cli/cloudflow/kubeclient/KubeClientFabric8.scala +++ b/core/cloudflow-cli/src/main/scala/akka/cli/cloudflow/kubeclient/KubeClientFabric8.scala @@ -100,22 +100,6 @@ class KubeClientFabric8( } } - private def getCrd(name: String, client: KubernetesClient) = { - client - .apiextensions() - .v1beta1() - .customResourceDefinitions() - .inAnyNamespace() - .list() - .getItems() - .asScala - .find { crd => - val crdName = crd.getMetadata.getName - logger.trace(s"Scanning Custom Resources found: ${name}") - crdName == name - } - } - private def getCloudflowApplicationsClient(client: KubernetesClient) = Try { val cloudflowClient = { diff --git a/core/cloudflow-cli/src/test/scala/akka/cli/cloudflow/kubeclient/Fabric8KubeClientSpec.scala b/core/cloudflow-cli/src/test/scala/akka/cli/cloudflow/kubeclient/Fabric8KubeClientSpec.scala index 0ce2f1b44..b45e2f514 100644 --- a/core/cloudflow-cli/src/test/scala/akka/cli/cloudflow/kubeclient/Fabric8KubeClientSpec.scala +++ b/core/cloudflow-cli/src/test/scala/akka/cli/cloudflow/kubeclient/Fabric8KubeClientSpec.scala @@ -28,7 +28,7 @@ class Fabric8KubeClientSpec extends AnyFlatSpec with Matchers with BeforeAndAfte .mkString("\n") server.expect.get - .withPath("/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions") + .withPath("/apis/apiextensions.k8s.io/v1/customresourcedefinitions") .andReturn( HttpURLConnection.HTTP_OK, Source diff --git a/core/cloudflow-crd/src/main/scala/akka/datap/crd/App.scala b/core/cloudflow-crd/src/main/scala/akka/datap/crd/App.scala index 2c7e8fdb3..aee45be49 100644 --- a/core/cloudflow-crd/src/main/scala/akka/datap/crd/App.scala +++ b/core/cloudflow-crd/src/main/scala/akka/datap/crd/App.scala @@ -13,14 +13,16 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.JsonDeserializer import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionBuilder +import io.fabric8.kubernetes.api.model.apiextensions.v1.{ + CustomResourceDefinitionBuilder, + CustomResourceDefinitionVersion, + CustomResourceDefinitionVersionBuilder +} import io.fabric8.kubernetes.api.model.{ KubernetesResource, Namespaced, ObjectMeta } import io.fabric8.kubernetes.client.{ CustomResource, CustomResourceList } import io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext import io.fabric8.kubernetes.model.annotation.{ Group, Kind, Plural, Version } -import scala.util.Try - object App { // GroupName for our CR @@ -50,6 +52,15 @@ object App { final val ProtocolVersionKey = "protocol-version" final val ProtocolVersion = "7" + val customResourceDefinitionVersion: CustomResourceDefinitionVersion = { + new CustomResourceDefinitionVersionBuilder() + .withName(GroupVersion) + .withNewSubresources() + .withNewStatus() + .endStatus() + .endSubresources() + .build() + } val customResourceDefinitionContext: CustomResourceDefinitionContext = new CustomResourceDefinitionContext.Builder() .withVersion(GroupVersion) @@ -73,13 +84,9 @@ object App { .withPlural(Plural) .withShortNames(Short) .endNames() - .withVersion(GroupVersion) + .withVersions(customResourceDefinitionVersion) .withScope("Namespaced") .withPreserveUnknownFields(true) - .withNewSubresources() - .withNewStatus() - .endStatus() - .endSubresources() .endSpec() .withNewStatus() .withStoredVersions(GroupVersion) diff --git a/core/cloudflow-operator/src/main/scala/cloudflow/operator/Main.scala b/core/cloudflow-operator/src/main/scala/cloudflow/operator/Main.scala index 5e21120fe..4a1b95355 100644 --- a/core/cloudflow-operator/src/main/scala/cloudflow/operator/Main.scala +++ b/core/cloudflow-operator/src/main/scala/cloudflow/operator/Main.scala @@ -129,11 +129,11 @@ object Main extends { Option( client .apiextensions() - .v1beta1() + .v1() .customResourceDefinitions() .withName(App.ResourceName) .get()) match { - case Some(crd) if crd.getSpec.getVersion == App.GroupVersion => + case Some(crd) if crd.getSpec.getVersions().asScala.exists(_.getName == App.GroupVersion) => system.log.info(s"CRD found at version ${App.GroupVersion}") case _ => system.log.error( diff --git a/core/cloudflow-operator/src/main/scala/cloudflow/operator/action/Name.scala b/core/cloudflow-operator/src/main/scala/cloudflow/operator/action/Name.scala index 78bc1bf1a..e97a75c5f 100644 --- a/core/cloudflow-operator/src/main/scala/cloudflow/operator/action/Name.scala +++ b/core/cloudflow-operator/src/main/scala/cloudflow/operator/action/Name.scala @@ -126,7 +126,7 @@ object Name { val ofContainerPrometheusExporterPort = max15Chars("prom-metrics") def ofService(streamletDeploymentName: String) = - truncateTo63CharactersWithSuffix(makeDNS1039Compatible(ofPod(streamletDeploymentName)), "-service") + truncateTo63CharactersWithSuffix(ofPod(streamletDeploymentName), "-service") def ofAdminService(streamletDeploymentName: String) = s"${ofPod(streamletDeploymentName)}-admin-service" diff --git a/core/tooling/src/main/scala/cli/CodepathCoverageMain.scala b/core/tooling/src/main/scala/cli/CodepathCoverageMain.scala index 3d1285c27..52c089c6c 100644 --- a/core/tooling/src/main/scala/cli/CodepathCoverageMain.scala +++ b/core/tooling/src/main/scala/cli/CodepathCoverageMain.scala @@ -143,7 +143,7 @@ object CodepathCoverageMain extends App { Serialization .jsonMapper() - .readValue("{}", classOf[io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionList]) + .readValue("{}", classOf[io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionList]) Serialization .jsonMapper()