diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 6ab6bd824e53c..ceb89a88f78ff 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -155,7 +155,7 @@ 1.7.22 1.6.4 1.4.1 - 6.2.0 + 6.3.1 3.1.3 3.2.0 4.2.0 diff --git a/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientProcessor.java b/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientProcessor.java index d171af78abf74..2cc925e13ded0 100644 --- a/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientProcessor.java +++ b/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientProcessor.java @@ -220,10 +220,11 @@ public void process(ApplicationIndexBuildItem applicationIndex, CombinedIndexBui log.debugv("Model Classes:\n{0}", String.join("\n", modelClasses)); } - // Register the default HttpClient implementation - serviceProviderProducer.produce(new ServiceProviderBuildItem( - HttpClient.Factory.class.getName(), "io.fabric8.kubernetes.client.okhttp.OkHttpClientFactory")); - + // Register all HttpClient implementations + serviceProviderProducer.produce(ServiceProviderBuildItem.allProvidersFromClassPath(HttpClient.Factory.class.getName())); + // Register all KubernetesResource providers (needed for the KubernetesDeserializer) + serviceProviderProducer.produce(ServiceProviderBuildItem.allProvidersFromClassPath(KubernetesResource.class.getName())); + // Register all KubernetesClient extensions serviceProviderProducer.produce(ServiceProviderBuildItem.allProvidersFromClassPath(ExtensionAdapter.class.getName())); // Enable SSL support by default diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithAutoMongoBindingTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithAutoMongoBindingTest.java index 562c5cedc1172..3eaf48a95541c 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithAutoMongoBindingTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithAutoMongoBindingTest.java @@ -6,10 +6,11 @@ import java.nio.file.Path; import java.util.List; +import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import io.dekorate.servicebinding.model.ServiceBinding; +import io.fabric8.kubernetes.api.model.GenericKubernetesResource; import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.kubernetes.api.model.apps.Deployment; import io.quarkus.builder.Version; @@ -58,26 +59,18 @@ public void assertGeneratedResources() throws IOException { }); }); - assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement().satisfies(i -> { - assertThat(i).isInstanceOfSatisfying(ServiceBinding.class, s -> { - assertThat(s.getMetadata()).satisfies(m -> { - assertThat(m.getName()).isEqualTo("kubernetes-with-auto-mogno-binding-mongodb"); - }); - assertThat(s.getSpec()).satisfies(spec -> { - assertThat(spec.getApplication()).satisfies(a -> { - assertThat(a.getGroup()).isEqualTo("apps"); - assertThat(a.getVersion()).isEqualTo("v1"); - assertThat(a.getKind()).isEqualTo("Deployment"); - }); - - assertThat(spec.getServices()).hasOnlyOneElementSatisfying(service -> { - assertThat(service.getGroup()).isEqualTo("psmdb.percona.com"); - assertThat(service.getVersion()).isEqualTo("v1-9-0"); - assertThat(service.getKind()).isEqualTo("PerconaServerMongoDB"); - assertThat(service.getName()).isEqualTo("mongodb"); - }); - }); - }); - }); + assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement() + .isInstanceOfSatisfying(GenericKubernetesResource.class, sb -> assertThat(sb) + .hasFieldOrPropertyWithValue("metadata.name", "kubernetes-with-auto-mogno-binding-mongodb") + .returns("apps", s -> s.get("spec", "application", "group")) + .returns("v1", s -> s.get("spec", "application", "version")) + .returns("Deployment", s -> s.get("spec", "application", "kind")) + .extracting(s -> s.get("spec", "services")) + .asList() + .singleElement().asInstanceOf(InstanceOfAssertFactories.MAP) + .containsEntry("group", "psmdb.percona.com") + .containsEntry("version", "v1-9-0") + .containsEntry("kind", "PerconaServerMongoDB") + .containsEntry("name", "mongodb")); } } diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithAutoMysqlBindingTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithAutoMysqlBindingTest.java index 848d754ef98c9..a2d2fe8d727bb 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithAutoMysqlBindingTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithAutoMysqlBindingTest.java @@ -6,10 +6,11 @@ import java.nio.file.Path; import java.util.List; +import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import io.dekorate.servicebinding.model.ServiceBinding; +import io.fabric8.kubernetes.api.model.GenericKubernetesResource; import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.kubernetes.api.model.apps.Deployment; import io.quarkus.builder.Version; @@ -59,26 +60,18 @@ public void assertGeneratedResources() throws IOException { }); }); - assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement().satisfies(i -> { - assertThat(i).isInstanceOfSatisfying(ServiceBinding.class, s -> { - assertThat(s.getMetadata()).satisfies(m -> { - assertThat(m.getName()).isEqualTo("kubernetes-with-auto-mysql-binding-mysql"); - }); - assertThat(s.getSpec()).satisfies(spec -> { - assertThat(spec.getApplication()).satisfies(a -> { - assertThat(a.getGroup()).isEqualTo("apps"); - assertThat(a.getVersion()).isEqualTo("v1"); - assertThat(a.getKind()).isEqualTo("Deployment"); - }); - - assertThat(spec.getServices()).hasOnlyOneElementSatisfying(service -> { - assertThat(service.getGroup()).isEqualTo("pxc.percona.com"); - assertThat(service.getVersion()).isEqualTo("v1-9-0"); - assertThat(service.getKind()).isEqualTo("PerconaXtraDBCluster"); - assertThat(service.getName()).isEqualTo("mysql"); - }); - }); - }); - }); + assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement() + .isInstanceOfSatisfying(GenericKubernetesResource.class, sb -> assertThat(sb) + .hasFieldOrPropertyWithValue("metadata.name", "kubernetes-with-auto-mysql-binding-mysql") + .returns("apps", s -> s.get("spec", "application", "group")) + .returns("v1", s -> s.get("spec", "application", "version")) + .returns("Deployment", s -> s.get("spec", "application", "kind")) + .extracting(s -> s.get("spec", "services")) + .asList() + .singleElement().asInstanceOf(InstanceOfAssertFactories.MAP) + .containsEntry("group", "pxc.percona.com") + .containsEntry("version", "v1-9-0") + .containsEntry("kind", "PerconaXtraDBCluster") + .containsEntry("name", "mysql")); } } diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithAutoPostgresBindingTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithAutoPostgresBindingTest.java index 3b6a8d10adebe..74f88cf30e2cc 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithAutoPostgresBindingTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithAutoPostgresBindingTest.java @@ -6,10 +6,11 @@ import java.nio.file.Path; import java.util.List; +import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import io.dekorate.servicebinding.model.ServiceBinding; +import io.fabric8.kubernetes.api.model.GenericKubernetesResource; import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.kubernetes.api.model.apps.Deployment; import io.quarkus.builder.Version; @@ -59,26 +60,18 @@ public void assertGeneratedResources() throws IOException { }); }); - assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement().satisfies(i -> { - assertThat(i).isInstanceOfSatisfying(ServiceBinding.class, s -> { - assertThat(s.getMetadata()).satisfies(m -> { - assertThat(m.getName()).isEqualTo("kubernetes-with-auto-postgres-binding-postgresql"); - }); - assertThat(s.getSpec()).satisfies(spec -> { - assertThat(spec.getApplication()).satisfies(a -> { - assertThat(a.getGroup()).isEqualTo("apps"); - assertThat(a.getVersion()).isEqualTo("v1"); - assertThat(a.getKind()).isEqualTo("Deployment"); - }); - - assertThat(spec.getServices()).hasOnlyOneElementSatisfying(service -> { - assertThat(service.getGroup()).isEqualTo("postgres-operator.crunchydata.com"); - assertThat(service.getVersion()).isEqualTo("v1beta1"); - assertThat(service.getKind()).isEqualTo("PostgresCluster"); - assertThat(service.getName()).isEqualTo("postgresql"); - }); - }); - }); - }); + assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement() + .isInstanceOfSatisfying(GenericKubernetesResource.class, sb -> assertThat(sb) + .hasFieldOrPropertyWithValue("metadata.name", "kubernetes-with-auto-postgres-binding-postgresql") + .returns("apps", s -> s.get("spec", "application", "group")) + .returns("v1", s -> s.get("spec", "application", "version")) + .returns("Deployment", s -> s.get("spec", "application", "kind")) + .extracting(s -> s.get("spec", "services")) + .asList() + .singleElement().asInstanceOf(InstanceOfAssertFactories.MAP) + .containsEntry("group", "postgres-operator.crunchydata.com") + .containsEntry("version", "v1beta1") + .containsEntry("kind", "PostgresCluster") + .containsEntry("name", "postgresql")); } } diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithSemiAutoPostgresBindingTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithSemiAutoPostgresBindingTest.java index ef435fb183291..bcf5659dac518 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithSemiAutoPostgresBindingTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithSemiAutoPostgresBindingTest.java @@ -6,10 +6,11 @@ import java.nio.file.Path; import java.util.List; +import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import io.dekorate.servicebinding.model.ServiceBinding; +import io.fabric8.kubernetes.api.model.GenericKubernetesResource; import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.kubernetes.api.model.apps.Deployment; import io.quarkus.builder.Version; @@ -59,26 +60,18 @@ public void assertGeneratedResources() throws IOException { }); }); - assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement().satisfies(i -> { - assertThat(i).isInstanceOfSatisfying(ServiceBinding.class, s -> { - assertThat(s.getMetadata()).satisfies(m -> { - assertThat(m.getName()).isEqualTo("kubernetes-with-semi-auto-postgres-binding-postgresql"); - }); - assertThat(s.getSpec()).satisfies(spec -> { - assertThat(spec.getApplication()).satisfies(a -> { - assertThat(a.getGroup()).isEqualTo("apps"); - assertThat(a.getVersion()).isEqualTo("v1"); - assertThat(a.getKind()).isEqualTo("Deployment"); - }); - - assertThat(spec.getServices()).hasOnlyOneElementSatisfying(service -> { - assertThat(service.getGroup()).isEqualTo("my.custom-operator.com"); - assertThat(service.getVersion()).isEqualTo("v1alpha1"); - assertThat(service.getKind()).isEqualTo("Postgres"); - assertThat(service.getName()).isEqualTo("postgresql"); - }); - }); - }); - }); + assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement() + .isInstanceOfSatisfying(GenericKubernetesResource.class, sb -> assertThat(sb) + .hasFieldOrPropertyWithValue("metadata.name", "kubernetes-with-semi-auto-postgres-binding-postgresql") + .returns("apps", s -> s.get("spec", "application", "group")) + .returns("v1", s -> s.get("spec", "application", "version")) + .returns("Deployment", s -> s.get("spec", "application", "kind")) + .extracting(s -> s.get("spec", "services")) + .asList() + .singleElement().asInstanceOf(InstanceOfAssertFactories.MAP) + .containsEntry("group", "my.custom-operator.com") + .containsEntry("version", "v1alpha1") + .containsEntry("kind", "Postgres") + .containsEntry("name", "postgresql")); } } diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithServiceBindingTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithServiceBindingTest.java index 70acd7f848af9..0203d1ecc7199 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithServiceBindingTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithServiceBindingTest.java @@ -7,10 +7,11 @@ import java.nio.file.Path; import java.util.List; +import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import io.dekorate.servicebinding.model.ServiceBinding; +import io.fabric8.kubernetes.api.model.GenericKubernetesResource; import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.kubernetes.api.model.apps.Deployment; import io.quarkus.builder.Version; @@ -58,26 +59,18 @@ public void assertGeneratedResources() throws IOException { }); }); - assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement().satisfies(i -> { - assertThat(i).isInstanceOfSatisfying(ServiceBinding.class, s -> { - assertThat(s.getMetadata()).satisfies(m -> { - assertThat(m.getName()).isEqualTo("kubernetes-with-service-binding-my-db"); - }); - assertThat(s.getSpec()).satisfies(spec -> { - assertThat(spec.getApplication()).satisfies(a -> { - assertThat(a.getGroup()).isEqualTo("apps"); - assertThat(a.getVersion()).isEqualTo("v1"); - assertThat(a.getKind()).isEqualTo("Deployment"); - }); - - assertThat(spec.getServices()).hasOnlyOneElementSatisfying(service -> { - assertThat(service.getGroup()).isEqualTo("apps"); - assertThat(service.getVersion()).isEqualTo("v1"); - assertThat(service.getKind()).isEqualTo("Deployment"); - assertThat(service.getName()).isEqualTo("my-postgres"); - }); - }); - }); - }); + assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement() + .isInstanceOfSatisfying(GenericKubernetesResource.class, sb -> assertThat(sb) + .hasFieldOrPropertyWithValue("metadata.name", "kubernetes-with-service-binding-my-db") + .returns("apps", s -> s.get("spec", "application", "group")) + .returns("v1", s -> s.get("spec", "application", "version")) + .returns("Deployment", s -> s.get("spec", "application", "kind")) + .extracting(s -> s.get("spec", "services")) + .asList() + .singleElement().asInstanceOf(InstanceOfAssertFactories.MAP) + .containsEntry("group", "apps") + .containsEntry("version", "v1") + .containsEntry("kind", "Deployment") + .containsEntry("name", "my-postgres")); } } diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithServiceBindingTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithServiceBindingTest.java index 8168a307a496a..565bbb8ea2811 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithServiceBindingTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithServiceBindingTest.java @@ -7,10 +7,11 @@ import java.nio.file.Path; import java.util.List; +import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import io.dekorate.servicebinding.model.ServiceBinding; +import io.fabric8.kubernetes.api.model.GenericKubernetesResource; import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.openshift.api.model.DeploymentConfig; import io.quarkus.builder.Version; @@ -52,26 +53,18 @@ public void assertGeneratedResources() throws IOException { }); }); - assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement().satisfies(i -> { - assertThat(i).isInstanceOfSatisfying(ServiceBinding.class, s -> { - assertThat(s.getMetadata()).satisfies(m -> { - assertThat(m.getName()).isEqualTo("openshift-with-service-binding-my-db"); - }); - assertThat(s.getSpec()).satisfies(spec -> { - assertThat(spec.getApplication()).satisfies(a -> { - assertThat(a.getGroup()).isEqualTo("apps.openshift.io"); - assertThat(a.getVersion()).isEqualTo("v1"); - assertThat(a.getKind()).isEqualTo("DeploymentConfig"); - }); - - assertThat(spec.getServices()).hasOnlyOneElementSatisfying(service -> { - assertThat(service.getGroup()).isEqualTo("apps"); - assertThat(service.getVersion()).isEqualTo("v1"); - assertThat(service.getKind()).isEqualTo("Deployment"); - assertThat(service.getName()).isEqualTo("my-postgres"); - }); - }); - }); - }); + assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement() + .isInstanceOfSatisfying(GenericKubernetesResource.class, sb -> assertThat(sb) + .hasFieldOrPropertyWithValue("metadata.name", "openshift-with-service-binding-my-db") + .returns("apps.openshift.io", s -> s.get("spec", "application", "group")) + .returns("v1", s -> s.get("spec", "application", "version")) + .returns("DeploymentConfig", s -> s.get("spec", "application", "kind")) + .extracting(s -> s.get("spec", "services")) + .asList() + .singleElement().asInstanceOf(InstanceOfAssertFactories.MAP) + .containsEntry("group", "apps") + .containsEntry("version", "v1") + .containsEntry("kind", "Deployment") + .containsEntry("name", "my-postgres")); } }