Search in sources :

Example 1 with OpenShiftService

use of io.syndesis.qe.marketplace.openshift.OpenShiftService in project syndesis-qe by syndesisio.

the class TestConfiguration method getOpenShiftService.

public static OpenShiftService getOpenShiftService(String quayProject) {
    OpenShiftUser defaultUser = new OpenShiftUser(syndesisUsername(), syndesisPassword(), openShiftUrl());
    OpenShiftUser adminUser = new OpenShiftUser(adminUsername(), adminPassword(), openShiftUrl());
    OpenShiftConfiguration openShiftConfiguration = OpenShiftConfiguration.builder().namespace(openShiftNamespace()).pullSecretName(syndesisPullSecretName()).pullSecret(syndesisPullSecret()).quayOpsrcToken(quayOpsrcToken()).icspConfigURL(operatorhubIcspScriptURL()).build();
    return new OpenShiftService(quayNamespace(), quayProject, openShiftConfiguration, adminUser, defaultUser);
}
Also used : OpenShiftUser(io.syndesis.qe.marketplace.openshift.OpenShiftUser) OpenShiftService(io.syndesis.qe.marketplace.openshift.OpenShiftService) OpenShiftConfiguration(io.syndesis.qe.marketplace.openshift.OpenShiftConfiguration)

Example 2 with OpenShiftService

use of io.syndesis.qe.marketplace.openshift.OpenShiftService in project syndesis-qe by syndesisio.

the class Syndesis method deployViaBundle.

private void deployViaBundle() {
    if (subscriptionExists()) {
        return;
    }
    Index index;
    Bundle foBundle = null;
    OpenShiftService ocpSvc;
    if (TestConfiguration.getBundleImage() != null) {
        ocpSvc = TestConfiguration.getOpenShiftService("fuse-online-index");
    } else {
        String[] parts = TestConfiguration.getIndexImage().split("/");
        String quayProject = parts[parts.length - 1].split(":")[0];
        ocpSvc = TestConfiguration.getOpenShiftService(quayProject);
    }
    Opm opm = new Opm(ocpSvc);
    QuayUser quayUser = TestConfiguration.getQuayUser();
    if (TestConfiguration.getBundleImage() != null) {
        // Deploy from bundle
        index = opm.createIndex("quay.io/marketplace/fuse-online-index:" + TestConfiguration.syndesisVersion());
        foBundle = index.addBundle(TestConfiguration.getBundleImage());
    } else {
        // deploy from existing index image
        index = opm.pullIndex(TestConfiguration.getIndexImage(), quayUser);
    }
    index.push(quayUser);
    try {
        // OCP stuff - add index
        ocpSvc.patchGlobalSecrets(TestConfiguration.getQuayPullSecret());
        index.addIndexToCluster(ocpSvc, "fuse-online-test-catalog");
        if (foBundle != null) {
            foBundle.createSubscription(ocpSvc);
        } else {
            Bundle.createSubscription(ocpSvc, "fuse-online", "fuse-online-7.9.x", "''", "fuse-online-test-catalog");
        }
        OpenShiftWaitUtils.waitFor(OpenShiftWaitUtils.areExactlyNPodsRunning("name", "syndesis-operator", 1));
    } catch (IOException | TimeoutException | InterruptedException e) {
        e.printStackTrace();
    }
    createPullSecret();
    if (TestConfiguration.enableTestSupport()) {
        TestUtils.withRetry(this::enableTestSupport, 5, 10, "Failed to patch CSV");
    }
    deployCrAndRoutes();
    CommonSteps.waitForSyndesis();
}
Also used : OpenShiftService(io.syndesis.qe.marketplace.openshift.OpenShiftService) Bundle(io.syndesis.qe.marketplace.manifests.Bundle) QuayUser(io.syndesis.qe.marketplace.quay.QuayUser) Index(io.syndesis.qe.marketplace.manifests.Index) IOException(java.io.IOException) Opm(io.syndesis.qe.marketplace.manifests.Opm) TimeoutException(java.util.concurrent.TimeoutException)

Example 3 with OpenShiftService

use of io.syndesis.qe.marketplace.openshift.OpenShiftService in project syndesis-qe by syndesisio.

the class CommonSteps method deployOperatorHub.

public static void deployOperatorHub() {
    Syndesis syndesis = ResourceFactory.get(Syndesis.class);
    QuayUser quayUser = TestConfiguration.getQuayUser();
    QuayService quayService = new QuayService(quayUser, TestConfiguration.syndesisOperatorImage(), syndesis.generateImageEnvVars());
    String quayProject;
    try {
        quayProject = quayService.createQuayProject();
    } catch (Exception e) {
        InfraFail.fail("Creating project on quay failed", e);
        return;
    }
    OpenShiftService openShiftService = TestConfiguration.getOpenShiftService(quayProject);
    try {
        openShiftService.deployOperator();
    } catch (IOException e) {
        InfraFail.fail("Deploying operator with marketplace failed", e);
    }
    // at this point we don't really need operator source anymore
    // and we doon't need project on quay either, because all the necessary stuff
    // has already been deployed, we can delete those
    log.info("Cleaning all unnecessary resorces");
    openShiftService.deleteOpsrcToken();
    try {
        openShiftService.deleteOperatorSource();
        quayService.deleteQuayProject();
    } catch (IOException e) {
        InfraFail.fail("Fail during cleanup of quay project", e);
    }
    syndesis.deployCrAndRoutes();
    CommonSteps.waitForSyndesis();
}
Also used : OpenShiftService(io.syndesis.qe.marketplace.openshift.OpenShiftService) QuayUser(io.syndesis.qe.marketplace.quay.QuayUser) IOException(java.io.IOException) QuayService(io.syndesis.qe.marketplace.quay.QuayService) Syndesis(io.syndesis.qe.resource.impl.Syndesis) TimeoutException(java.util.concurrent.TimeoutException) WaiterException(cz.xtf.core.waiting.WaiterException) KubernetesClientException(io.fabric8.kubernetes.client.KubernetesClientException) IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

OpenShiftService (io.syndesis.qe.marketplace.openshift.OpenShiftService)3 QuayUser (io.syndesis.qe.marketplace.quay.QuayUser)2 IOException (java.io.IOException)2 TimeoutException (java.util.concurrent.TimeoutException)2 WaiterException (cz.xtf.core.waiting.WaiterException)1 KubernetesClientException (io.fabric8.kubernetes.client.KubernetesClientException)1 Bundle (io.syndesis.qe.marketplace.manifests.Bundle)1 Index (io.syndesis.qe.marketplace.manifests.Index)1 Opm (io.syndesis.qe.marketplace.manifests.Opm)1 OpenShiftConfiguration (io.syndesis.qe.marketplace.openshift.OpenShiftConfiguration)1 OpenShiftUser (io.syndesis.qe.marketplace.openshift.OpenShiftUser)1 QuayService (io.syndesis.qe.marketplace.quay.QuayService)1 Syndesis (io.syndesis.qe.resource.impl.Syndesis)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1