diff --git a/extensions/openshift-client/runtime/pom.xml b/extensions/openshift-client/runtime/pom.xml index 18fa13c77c2328..fd62cdfb36faac 100644 --- a/extensions/openshift-client/runtime/pom.xml +++ b/extensions/openshift-client/runtime/pom.xml @@ -41,6 +41,11 @@ + + org.graalvm.sdk + graal-sdk + provided + @@ -70,4 +75,4 @@ - \ No newline at end of file + diff --git a/extensions/openshift-client/runtime/src/main/java/io/quarkus/it/openshift/client/runtime/graal/MiscellaneousSubstitutions.java b/extensions/openshift-client/runtime/src/main/java/io/quarkus/it/openshift/client/runtime/graal/MiscellaneousSubstitutions.java new file mode 100644 index 00000000000000..3d1284aee3c8dc --- /dev/null +++ b/extensions/openshift-client/runtime/src/main/java/io/quarkus/it/openshift/client/runtime/graal/MiscellaneousSubstitutions.java @@ -0,0 +1,97 @@ +package io.quarkus.it.openshift.client.runtime.graal; + +import java.util.Arrays; +import java.util.function.BooleanSupplier; + +import com.oracle.svm.core.annotate.Substitute; +import com.oracle.svm.core.annotate.TargetClass; + +import io.fabric8.kubernetes.client.dsl.MixedOperation; +import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; +import io.fabric8.kubernetes.client.dsl.Resource; +import io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.APIRequestCount; +import io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.APIRequestCountList; +import io.fabric8.openshift.api.model.miscellaneous.cloudcredential.v1.CredentialsRequest; +import io.fabric8.openshift.api.model.miscellaneous.cloudcredential.v1.CredentialsRequestList; +import io.fabric8.openshift.api.model.miscellaneous.cncf.cni.v1.NetworkAttachmentDefinition; +import io.fabric8.openshift.api.model.miscellaneous.cncf.cni.v1.NetworkAttachmentDefinitionList; +import io.fabric8.openshift.api.model.miscellaneous.imageregistry.operator.v1.Config; +import io.fabric8.openshift.api.model.miscellaneous.imageregistry.operator.v1.ConfigList; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.BareMetalHost; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.BareMetalHostList; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3Remediation; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationList; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplate; +import io.fabric8.openshift.api.model.miscellaneous.metal3.v1beta1.Metal3RemediationTemplateList; +import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.EgressRouter; +import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.EgressRouterList; +import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.OperatorPKI; +import io.fabric8.openshift.api.model.miscellaneous.network.operator.v1.OperatorPKIList; + +/** + * Allows the exclusion of the openshift-model-miscellaneous model without breaking the --link-at-build-time check. + */ +@TargetClass(className = "io.fabric8.openshift.client.impl.OpenShiftClientImpl", onlyWith = MiscellaneousSubstitutions.NoOpenShiftMiscellaneousModel.class) +public final class MiscellaneousSubstitutions { + + @Substitute + public NonNamespaceOperation> apiRequestCounts() { + throw new RuntimeException(Constants.ERROR_MESSAGE); + } + + @Substitute + public MixedOperation> bareMetalHosts() { + throw new RuntimeException(Constants.ERROR_MESSAGE); + } + + @Substitute + public MixedOperation> credentialsRequests() { + throw new RuntimeException(Constants.ERROR_MESSAGE); + } + + @Substitute + public MixedOperation> egressRouters() { + throw new RuntimeException(Constants.ERROR_MESSAGE); + } + + @Substitute + public NonNamespaceOperation> imageRegistryOperatorConfigs() { + throw new RuntimeException(Constants.ERROR_MESSAGE); + } + + @Substitute + public MixedOperation> metal3Remediations() { + throw new RuntimeException(Constants.ERROR_MESSAGE); + } + + @Substitute + public MixedOperation> metal3RemediationTemplates() { + throw new RuntimeException(Constants.ERROR_MESSAGE); + } + + @Substitute + public MixedOperation> networkAttachmentDefinitions() { + throw new RuntimeException(Constants.ERROR_MESSAGE); + } + + @Substitute + public MixedOperation> operatorPKIs() { + throw new RuntimeException(Constants.ERROR_MESSAGE); + } + + static final class Constants { + private static final String ERROR_MESSAGE = "OpenShift Miscellaneous API is not available, please add the openshift-model-miscellaneous module to your classpath"; + } + + static final class NoOpenShiftMiscellaneousModel implements BooleanSupplier { + + private static final String OPENSHIFT_MODEL_MISCELLANEOUS_PACKAGE = "io.fabric8.openshift.api.model.miscellaneous."; + static final Boolean OPENSHIFT_MODEL_MISCELLANEOUS_PRESENT = Arrays.stream(Package.getPackages()) + .map(Package::getName).anyMatch(p -> p.startsWith(OPENSHIFT_MODEL_MISCELLANEOUS_PACKAGE)); + + @Override + public boolean getAsBoolean() { + return !OPENSHIFT_MODEL_MISCELLANEOUS_PRESENT; + } + } +} diff --git a/extensions/openshift-client/runtime/src/main/java/io/quarkus/it/openshift/client/runtime/graal/OperatorSubstitutions.java b/extensions/openshift-client/runtime/src/main/java/io/quarkus/it/openshift/client/runtime/graal/OperatorSubstitutions.java new file mode 100644 index 00000000000000..3730608f29f249 --- /dev/null +++ b/extensions/openshift-client/runtime/src/main/java/io/quarkus/it/openshift/client/runtime/graal/OperatorSubstitutions.java @@ -0,0 +1,34 @@ +package io.quarkus.it.openshift.client.runtime.graal; + +import java.util.Arrays; +import java.util.function.BooleanSupplier; + +import com.oracle.svm.core.annotate.Substitute; +import com.oracle.svm.core.annotate.TargetClass; + +import io.fabric8.openshift.client.dsl.OpenShiftOperatorAPIGroupDSL; + +/** + * Allows the exclusion of the openshift-model-operator model without breaking the --link-at-build-time check. + */ +@TargetClass(className = "io.fabric8.openshift.client.impl.OpenShiftClientImpl", onlyWith = OperatorSubstitutions.NoOpenShiftOperatorModel.class) +public final class OperatorSubstitutions { + + @Substitute + public OpenShiftOperatorAPIGroupDSL operator() { + throw new RuntimeException( + "OpenShift Operator API is not available, please add the openshift-model-operator module to your classpath"); + } + + static final class NoOpenShiftOperatorModel implements BooleanSupplier { + + private static final String OPENSHIFT_MODEL_OPERATOR_PACKAGE = "io.fabric8.openshift.api.model.operator."; + static final Boolean OPENSHIFT_MODEL_OPERATOR_PRESENT = Arrays.stream(Package.getPackages()) + .map(Package::getName).anyMatch(p -> p.startsWith(OPENSHIFT_MODEL_OPERATOR_PACKAGE)); + + @Override + public boolean getAsBoolean() { + return !OPENSHIFT_MODEL_OPERATOR_PRESENT; + } + } +} diff --git a/integration-tests/kubernetes-client-hack-extension/deployment/pom.xml b/integration-tests/kubernetes-client-hack-extension/deployment/pom.xml deleted file mode 100644 index 913462707b124c..00000000000000 --- a/integration-tests/kubernetes-client-hack-extension/deployment/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - 4.0.0 - - - io.quarkus - quarkus-integration-test-kubernetes-client-hack-extension-parent - 999-SNAPSHOT - - - quarkus-integration-test-kubernetes-client-hack-extension-deployment - Quarkus - Integration Tests - Kubernetes Client Hack Extension - Deployment - - - - io.quarkus - quarkus-core-deployment - ${project.version} - - - io.quarkus - quarkus-integration-test-kubernetes-client-hack-extension - ${project.version} - - - - - - - maven-compiler-plugin - - - - io.quarkus - quarkus-extension-processor - ${project.version} - - - - - - org.codehaus.mojo - templating-maven-plugin - 1.0.0 - - - filtering-java-templates - - filter-sources - - - - - - - diff --git a/integration-tests/kubernetes-client-hack-extension/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/NativeOverrides.java b/integration-tests/kubernetes-client-hack-extension/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/NativeOverrides.java deleted file mode 100644 index 91372ea46589e1..00000000000000 --- a/integration-tests/kubernetes-client-hack-extension/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/NativeOverrides.java +++ /dev/null @@ -1,12 +0,0 @@ -package io.quarkus.kubernetes.client.deployment; - -import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.builditem.nativeimage.NativeImageAllowIncompleteClasspathBuildItem; - -public class NativeOverrides { - - @BuildStep - NativeImageAllowIncompleteClasspathBuildItem incompleteModel() { - return new NativeImageAllowIncompleteClasspathBuildItem("quarkus-kubernetes-client"); - } -} diff --git a/integration-tests/kubernetes-client-hack-extension/pom.xml b/integration-tests/kubernetes-client-hack-extension/pom.xml deleted file mode 100644 index c29e01f59239c3..00000000000000 --- a/integration-tests/kubernetes-client-hack-extension/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - 4.0.0 - - - quarkus-extensions-parent - io.quarkus - 999-SNAPSHOT - ../../extensions/pom.xml - - - quarkus-integration-test-kubernetes-client-hack-extension-parent - Quarkus - Integration Tests - Kubernetes Client Hack Extension - pom - - deployment - runtime - - diff --git a/integration-tests/kubernetes-client-hack-extension/runtime/pom.xml b/integration-tests/kubernetes-client-hack-extension/runtime/pom.xml deleted file mode 100644 index a0278c43dafaa9..00000000000000 --- a/integration-tests/kubernetes-client-hack-extension/runtime/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - 4.0.0 - - - io.quarkus - quarkus-integration-test-kubernetes-client-hack-extension-parent - 999-SNAPSHOT - - - quarkus-integration-test-kubernetes-client-hack-extension - Quarkus - Integration Tests - Kubernetes Client Hack Extension - Runtime - - - - io.quarkus - quarkus-core - ${project.version} - - - - - - - io.quarkus - quarkus-extension-maven-plugin - ${project.version} - - ${project.groupId}:${project.artifactId}-deployment:${project.version} - - - - maven-compiler-plugin - - - - io.quarkus - quarkus-extension-processor - ${project.version} - - - - - - - diff --git a/integration-tests/kubernetes-client-hack-extension/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/integration-tests/kubernetes-client-hack-extension/runtime/src/main/resources/META-INF/quarkus-extension.yaml deleted file mode 100644 index 42eda1b64d7c59..00000000000000 --- a/integration-tests/kubernetes-client-hack-extension/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -artifact: ${project.groupId}:${project.artifactId}:${project.version} -name: "Kubernetes Client Hack Extension" -metadata: - keywords: - - "kubernetes-client" - guide: "https://quarkus.io/guides/kubernetes-client" - categories: - - "cloud" - status: "test" - config: diff --git a/integration-tests/kubernetes-client/pom.xml b/integration-tests/kubernetes-client/pom.xml index a08bd4306d3977..74540dca954064 100644 --- a/integration-tests/kubernetes-client/pom.xml +++ b/integration-tests/kubernetes-client/pom.xml @@ -22,22 +22,21 @@ io.quarkus quarkus-kubernetes-config - - io.quarkus - quarkus-integration-test-kubernetes-client-hack-extension - ${project.version} - io.quarkus quarkus-openshift-client io.fabric8 - openshift-model-operator + openshift-model-hive io.fabric8 - openshift-model-operator-hub + openshift-model-miscellaneous + + + io.fabric8 + openshift-model-operator @@ -90,19 +89,6 @@ - - io.quarkus - quarkus-integration-test-kubernetes-client-hack-extension-deployment - ${project.version} - pom - test - - - * - * - - - io.quarkus quarkus-openshift-client-deployment diff --git a/integration-tests/openshift-client/pom.xml b/integration-tests/openshift-client/pom.xml index eef764d55f5e64..82629e66d5b56d 100644 --- a/integration-tests/openshift-client/pom.xml +++ b/integration-tests/openshift-client/pom.xml @@ -22,11 +22,6 @@ io.quarkus quarkus-resteasy-jackson - - io.quarkus - quarkus-integration-test-kubernetes-client-hack-extension - ${project.version} - io.quarkus quarkus-openshift-client @@ -34,11 +29,15 @@ io.fabric8 - openshift-model-operator + openshift-model-hive io.fabric8 - openshift-model-operator-hub + openshift-model-miscellaneous + + + io.fabric8 + openshift-model-operator @@ -70,19 +69,6 @@ - - io.quarkus - quarkus-integration-test-kubernetes-client-hack-extension-deployment - ${project.version} - pom - test - - - * - * - - - io.quarkus quarkus-openshift-client-deployment diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 8e027683779b5f..1b406e057b3d8a 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -285,7 +285,6 @@ amazon-lambda-http-resteasy amazon-lambda-http-resteasy-reactive container-image - kubernetes-client-hack-extension kubernetes kubernetes-client kubernetes-client-devservices