Search in sources :

Example 1 with OlmResource

use of io.strimzi.systemtest.resources.operator.specific.OlmResource in project strimzi by strimzi.

the class SetupClusterOperator method runInstallation.

/**
 * This method install Strimzi Cluster Operator based on environment variable configuration.
 * It can install operator by classic way (apply bundle yamls) or use OLM. For OLM you need to set all other OLM env variables.
 * Don't use this method in tests, where specific configuration of CO is needed.
 */
@SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
public SetupClusterOperator runInstallation() {
    LOGGER.info("Cluster operator installation configuration:\n{}", this::prettyPrint);
    LOGGER.debug("Cluster operator installation configuration:\n{}", this::toString);
    // if it's shared context (before suite) skip
    if (BeforeAllOnce.getSharedExtensionContext() != extensionContext) {
        testClassName = extensionContext.getRequiredTestClass() != null ? extensionContext.getRequiredTestClass().getName() : "";
        testMethodName = extensionContext.getDisplayName() != null ? extensionContext.getDisplayName() : "";
    }
    if (Environment.isOlmInstall()) {
        LOGGER.info("Install ClusterOperator via OLM");
        // cluster-wide olm co-operator or multi-namespaces in once we also deploy cluster-wide
        if (IS_OLM_CLUSTER_WIDE.test(namespaceToWatch)) {
            // if RBAC is enable we don't run tests in parallel mode and with that said we don't create another namespaces
            if (!Environment.isNamespaceRbacScope()) {
                if (isClusterOperatorNamespaceNotCreated()) {
                    cluster.setNamespace(namespaceInstallTo);
                    cluster.createNamespaces(CollectorElement.createCollectorElement(testClassName, testMethodName), namespaceInstallTo, bindingsNamespaces);
                    extensionContext.getStore(ExtensionContext.Namespace.GLOBAL).put(Constants.PREPARE_OPERATOR_ENV_KEY + namespaceInstallTo, false);
                }
                createClusterRoleBindings();
                namespaceInstallTo = cluster.getDefaultOlmNamespace();
                olmResource = new OlmResource(namespaceInstallTo);
                olmResource.create(extensionContext, operationTimeout, reconciliationInterval);
            }
        // single-namespace olm co-operator
        } else {
            if (isClusterOperatorNamespaceNotCreated()) {
                cluster.setNamespace(namespaceInstallTo);
                cluster.createNamespaces(CollectorElement.createCollectorElement(testClassName, testMethodName), namespaceInstallTo, bindingsNamespaces);
                extensionContext.getStore(ExtensionContext.Namespace.GLOBAL).put(Constants.PREPARE_OPERATOR_ENV_KEY + namespaceInstallTo, false);
            }
            olmResource = new OlmResource(namespaceInstallTo);
            olmResource.create(extensionContext, operationTimeout, reconciliationInterval);
        }
    } else if (Environment.isHelmInstall()) {
        LOGGER.info("Install ClusterOperator via Helm");
        helmResource = new HelmResource(namespaceInstallTo, namespaceToWatch);
        if (isClusterOperatorNamespaceNotCreated()) {
            cluster.setNamespace(namespaceInstallTo);
            cluster.createNamespaces(CollectorElement.createCollectorElement(testClassName, testMethodName), namespaceInstallTo, bindingsNamespaces);
            extensionContext.getStore(ExtensionContext.Namespace.GLOBAL).put(Constants.PREPARE_OPERATOR_ENV_KEY + namespaceInstallTo, false);
        }
        helmResource.create(extensionContext, operationTimeout, reconciliationInterval);
    } else {
        bundleInstallation();
    }
    return this;
}
Also used : OlmResource(io.strimzi.systemtest.resources.operator.specific.OlmResource) HelmResource(io.strimzi.systemtest.resources.operator.specific.HelmResource) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 2 with OlmResource

use of io.strimzi.systemtest.resources.operator.specific.OlmResource in project strimzi by strimzi.

the class OlmUpgradeIsolatedST method setup.

@BeforeAll
void setup() {
    cluster.setNamespace(namespace);
    cluster.createNamespace(namespace);
    olmResource = new OlmResource(namespace);
}
Also used : OlmResource(io.strimzi.systemtest.resources.operator.specific.OlmResource) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with OlmResource

use of io.strimzi.systemtest.resources.operator.specific.OlmResource in project strimzi-kafka-operator by strimzi.

the class AllNamespacesIsolatedST method setup.

@BeforeAll
void setup(ExtensionContext extensionContext) {
    cluster.setNamespace(cluster.getDefaultOlmNamespace());
    olmResource = new OlmResource(cluster.getDefaultOlmNamespace());
    olmResource.create(extensionContext);
    cluster.setNamespace(NAMESPACE);
    cluster.createNamespace(NAMESPACE);
}
Also used : OlmResource(io.strimzi.systemtest.resources.operator.specific.OlmResource) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 4 with OlmResource

use of io.strimzi.systemtest.resources.operator.specific.OlmResource in project strimzi by strimzi.

the class AllNamespacesIsolatedST method setup.

@BeforeAll
void setup(ExtensionContext extensionContext) {
    cluster.setNamespace(cluster.getDefaultOlmNamespace());
    olmResource = new OlmResource(cluster.getDefaultOlmNamespace());
    olmResource.create(extensionContext);
    cluster.setNamespace(NAMESPACE);
    cluster.createNamespace(NAMESPACE);
}
Also used : OlmResource(io.strimzi.systemtest.resources.operator.specific.OlmResource) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 5 with OlmResource

use of io.strimzi.systemtest.resources.operator.specific.OlmResource in project strimzi by strimzi.

the class SingleNamespaceIsolatedST method setup.

@BeforeAll
void setup(ExtensionContext extensionContext) {
    cluster.setNamespace(NAMESPACE);
    cluster.createNamespace(NAMESPACE);
    olmResource = new OlmResource(NAMESPACE);
    olmResource.create(extensionContext);
}
Also used : OlmResource(io.strimzi.systemtest.resources.operator.specific.OlmResource) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

OlmResource (io.strimzi.systemtest.resources.operator.specific.OlmResource)8 BeforeAll (org.junit.jupiter.api.BeforeAll)6 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)2 HelmResource (io.strimzi.systemtest.resources.operator.specific.HelmResource)2