-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37278 from manusa/feat/model-exclussions
Allow for model module exclusions in native mode
- Loading branch information
Showing
11 changed files
with
149 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
...rc/main/java/io/quarkus/it/openshift/client/runtime/graal/MiscellaneousSubstitutions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<APIRequestCount, APIRequestCountList, Resource<APIRequestCount>> apiRequestCounts() { | ||
throw new RuntimeException(Constants.ERROR_MESSAGE); | ||
} | ||
|
||
@Substitute | ||
public MixedOperation<BareMetalHost, BareMetalHostList, Resource<BareMetalHost>> bareMetalHosts() { | ||
throw new RuntimeException(Constants.ERROR_MESSAGE); | ||
} | ||
|
||
@Substitute | ||
public MixedOperation<CredentialsRequest, CredentialsRequestList, Resource<CredentialsRequest>> credentialsRequests() { | ||
throw new RuntimeException(Constants.ERROR_MESSAGE); | ||
} | ||
|
||
@Substitute | ||
public MixedOperation<EgressRouter, EgressRouterList, Resource<EgressRouter>> egressRouters() { | ||
throw new RuntimeException(Constants.ERROR_MESSAGE); | ||
} | ||
|
||
@Substitute | ||
public NonNamespaceOperation<Config, ConfigList, Resource<Config>> imageRegistryOperatorConfigs() { | ||
throw new RuntimeException(Constants.ERROR_MESSAGE); | ||
} | ||
|
||
@Substitute | ||
public MixedOperation<Metal3Remediation, Metal3RemediationList, Resource<Metal3Remediation>> metal3Remediations() { | ||
throw new RuntimeException(Constants.ERROR_MESSAGE); | ||
} | ||
|
||
@Substitute | ||
public MixedOperation<Metal3RemediationTemplate, Metal3RemediationTemplateList, Resource<Metal3RemediationTemplate>> metal3RemediationTemplates() { | ||
throw new RuntimeException(Constants.ERROR_MESSAGE); | ||
} | ||
|
||
@Substitute | ||
public MixedOperation<NetworkAttachmentDefinition, NetworkAttachmentDefinitionList, Resource<NetworkAttachmentDefinition>> networkAttachmentDefinitions() { | ||
throw new RuntimeException(Constants.ERROR_MESSAGE); | ||
} | ||
|
||
@Substitute | ||
public MixedOperation<OperatorPKI, OperatorPKIList, Resource<OperatorPKI>> 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; | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...ime/src/main/java/io/quarkus/it/openshift/client/runtime/graal/OperatorSubstitutions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
} |
58 changes: 0 additions & 58 deletions
58
integration-tests/kubernetes-client-hack-extension/deployment/pom.xml
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...ion/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/NativeOverrides.java
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
integration-tests/kubernetes-client-hack-extension/pom.xml
This file was deleted.
Oops, something went wrong.
48 changes: 0 additions & 48 deletions
48
integration-tests/kubernetes-client-hack-extension/runtime/pom.xml
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...bernetes-client-hack-extension/runtime/src/main/resources/META-INF/quarkus-extension.yaml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.