Class LocallyRunOperatorExtension
java.lang.Object
io.javaoperatorsdk.operator.junit.AbstractOperatorExtension
io.javaoperatorsdk.operator.junit.LocallyRunOperatorExtension
- All Implemented Interfaces:
HasKubernetesClient,org.junit.jupiter.api.extension.AfterAllCallback,org.junit.jupiter.api.extension.AfterEachCallback,org.junit.jupiter.api.extension.BeforeAllCallback,org.junit.jupiter.api.extension.BeforeEachCallback,org.junit.jupiter.api.extension.Extension
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class io.javaoperatorsdk.operator.junit.AbstractOperatorExtension
AbstractOperatorExtension.AbstractBuilder<T extends AbstractOperatorExtension.AbstractBuilder<T>> -
Field Summary
Fields inherited from class io.javaoperatorsdk.operator.junit.AbstractOperatorExtension
CRD_READY_WAIT, DEFAULT_NAMESPACE_DELETE_TIMEOUT, infrastructure, infrastructureTimeout, MAX_NAMESPACE_NAME_LENGTH, namespace, namespaceDeleteTimeout, namespaceNameSupplier, oneNamespacePerClass, perClassNamespaceNameSupplier, preserveNamespaceOnError, skipNamespaceDeletion, waitForNamespaceDeletion -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafter(org.junit.jupiter.api.extension.ExtensionContext context) voidapplyCrd(io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinition customResourceDefinition) static voidapplyCrd(Class<? extends io.fabric8.kubernetes.api.model.HasMetadata> resourceClass, io.fabric8.kubernetes.client.KubernetesClient client) voidApplies the CRD associated with the specified custom resource, first checking if a CRD has been manually specified usingLocallyRunOperatorExtension.Builder.withAdditionalCRD(java.lang.String...), otherwise assuming that its CRD should be found in the standard location as explained inapplyCrd(String, KubernetesClient)voidApplies the CRD associated with the specified resource type name, first checking if a CRD has been manually specified usingLocallyRunOperatorExtension.Builder.withAdditionalCRD(java.lang.String...), otherwise assuming that its CRD should be found in the standard location as explained inapplyCrd(String, KubernetesClient)static voidApplies the CRD associated with the specified resource name to the cluster.protected voidbefore(org.junit.jupiter.api.extension.ExtensionContext context) builder()Creates aLocallyRunOperatorExtension.Builderto set up anLocallyRunOperatorExtensioninstance.io.javaoperatorsdk.operator.api.reconciler.Reconcilerio.javaoperatorsdk.operator.Operator<T extends io.javaoperatorsdk.operator.api.reconciler.Reconciler>
TgetReconcilerOfType(Class<T> type) List<io.javaoperatorsdk.operator.api.reconciler.Reconciler>io.javaoperatorsdk.operator.RegisteredControllergetRegisteredControllerForReconcile(Class<? extends io.javaoperatorsdk.operator.api.reconciler.Reconciler> type) Methods inherited from class io.javaoperatorsdk.operator.junit.AbstractOperatorExtension
afterAll, afterAllImpl, afterEach, afterEachImpl, beforeAll, beforeAllImpl, beforeEach, beforeEachImpl, create, delete, deleteOperator, get, getInfrastructureKubernetesClient, getKubernetesClient, getNamespace, replace, resources, serverSideApply, update
-
Method Details
-
builder
Creates aLocallyRunOperatorExtension.Builderto set up anLocallyRunOperatorExtensioninstance.- Returns:
- the builder.
-
applyCrd
public static void applyCrd(Class<? extends io.fabric8.kubernetes.api.model.HasMetadata> resourceClass, io.fabric8.kubernetes.client.KubernetesClient client) -
applyCrd
public static void applyCrd(String resourceTypeName, io.fabric8.kubernetes.client.KubernetesClient client) Applies the CRD associated with the specified resource name to the cluster. Note that the CRD is assumed to have been generated in this case from the Java classes and is therefore expected to be found in the standard location with the default name for such CRDs and assumes a v1 version of the CRD spec is used. This means that, provided a givenresourceTypeName, the associated CRD is expected to be found atMETA-INF/fabric8/resourceTypeName-v1.ymlin the project's classpath.- Parameters:
resourceTypeName- the standard resource name for CRDs i.e.plural.groupclient- the kubernetes client to use to connect to the cluster
-
applyCrd
Applies the CRD associated with the specified custom resource, first checking if a CRD has been manually specified usingLocallyRunOperatorExtension.Builder.withAdditionalCRD(java.lang.String...), otherwise assuming that its CRD should be found in the standard location as explained inapplyCrd(String, KubernetesClient)- Parameters:
crClass- the custom resource class for which we want to apply the CRD
-
applyCrd
public void applyCrd(io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinition customResourceDefinition) -
applyCrd
Applies the CRD associated with the specified resource type name, first checking if a CRD has been manually specified usingLocallyRunOperatorExtension.Builder.withAdditionalCRD(java.lang.String...), otherwise assuming that its CRD should be found in the standard location as explained inapplyCrd(String, KubernetesClient)- Parameters:
resourceTypeName- the resource type name associated with the CRD to be applied, typically, given a resource type, its name would be obtained usingReconcilerUtilsInternal.getResourceTypeName(Class)
-
getReconcilers
-
getFirstReconciler
public io.javaoperatorsdk.operator.api.reconciler.Reconciler getFirstReconciler() -
getReconcilerOfType
public <T extends io.javaoperatorsdk.operator.api.reconciler.Reconciler> T getReconcilerOfType(Class<T> type) -
getRegisteredControllerForReconcile
public io.javaoperatorsdk.operator.RegisteredController getRegisteredControllerForReconcile(Class<? extends io.javaoperatorsdk.operator.api.reconciler.Reconciler> type) -
getOperator
public io.javaoperatorsdk.operator.Operator getOperator() -
before
protected void before(org.junit.jupiter.api.extension.ExtensionContext context) - Overrides:
beforein classAbstractOperatorExtension
-
after
protected void after(org.junit.jupiter.api.extension.ExtensionContext context) - Overrides:
afterin classAbstractOperatorExtension
-