Skip to content

Commit

Permalink
Update default OLM version for downstream install
Browse files Browse the repository at this point in the history
  • Loading branch information
jiridanek committed Mar 10, 2024
1 parent 47eb89f commit 1d8c698
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/main/java/io/odh/test/OdhConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ private OdhConstants() { }
private static final String RHOAI_OLM_OPERATOR_DEPLOYMENT_NAME = "rhods-operator";
private static final String RHOAI_OLM_SOURCE_NAME = "redhat-operators";
private static final String RHOAI_OLM_APP_BUNDLE_PREFIX = "rhods-operator";
private static final String RHOAI_OLM_OPERATOR_CHANNEL = "stable";
private static final String RHOAI_OLM_OPERATOR_VERSION = "2.6.0";
private static final String RHOAI_OLM_UPGRADE_STARTING_OPERATOR_VERSION = "2.5.0";
private static final String RHOAI_OLM_OPERATOR_CHANNEL = "fast";
private static final String RHOAI_OLM_OPERATOR_VERSION = "2.7.0";
private static final String RHOAI_OLM_UPGRADE_STARTING_OPERATOR_VERSION = "2.6.0";
private static final String RHOAI_MONITORING_NAMESPACE = "redhat-ods-monitoring";

// Public part
Expand Down
40 changes: 40 additions & 0 deletions src/main/java/io/odh/test/utils/CsvUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright Skodjob authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/

package io.odh.test.utils;

import io.fabric8.openshift.api.model.operatorhub.v1alpha1.ClusterServiceVersion;
import io.fabric8.openshift.client.OpenShiftClient;
import io.odh.test.OdhConstants;
import io.odh.test.framework.manager.ResourceManager;
import org.hamcrest.Matchers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.Nullable;

import java.util.List;

import static org.hamcrest.MatcherAssert.assertThat;

public class CsvUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(NamespaceUtils.class);

public static @Nullable String getOperatorVersionFromCsv() {
String name = OdhConstants.OLM_OPERATOR_NAME;
String namespace = OdhConstants.OLM_OPERATOR_NAMESPACE;
OpenShiftClient client = (OpenShiftClient) ResourceManager.getKubeClient().getClient();
List<ClusterServiceVersion> csvs = client.resources(ClusterServiceVersion.class)
.inNamespace(namespace)
.withLabel("operators.coreos.com/" + name + "." + namespace, "")
.list().getItems();
LOGGER.debug("Found {} datascience operator CSVs", csvs.size());
if (csvs.isEmpty()) {
return "";
}
assertThat(csvs, Matchers.hasSize(1));
return csvs.get(0).getSpec().getVersion();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
import io.fabric8.kubernetes.api.model.KubernetesResourceList;
import io.fabric8.kubernetes.client.dsl.MixedOperation;
import io.fabric8.kubernetes.client.dsl.Resource;
import io.odh.test.Environment;
import io.odh.test.OdhConstants;
import io.odh.test.TestSuite;
import io.odh.test.e2e.Abstract;
import io.odh.test.framework.manager.ResourceManager;
import io.odh.test.framework.manager.resources.DataScienceClusterResource;
import io.odh.test.install.InstallTypes;
import io.odh.test.platform.KubeUtils;
import io.odh.test.utils.CsvUtils;
import io.opendatahub.datasciencecluster.v1.DataScienceCluster;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Codeflare;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Dashboard;
Expand All @@ -27,6 +30,8 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import java.util.Objects;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
Expand Down Expand Up @@ -56,7 +61,14 @@ void checkDataScienceClusterExists() {
assertEquals(Ray.ManagementState.MANAGED, cluster.getSpec().getComponents().getRay().getManagementState());
assertEquals(Modelmeshserving.ManagementState.MANAGED, cluster.getSpec().getComponents().getModelmeshserving().getManagementState());
assertEquals(Datasciencepipelines.ManagementState.MANAGED, cluster.getSpec().getComponents().getDatasciencepipelines().getManagementState());
assertEquals(Kueue.ManagementState.MANAGED, cluster.getSpec().getComponents().getKueue().getManagementState());
if (!Environment.PRODUCT.equals(Environment.PRODUCT_DEFAULT)
&& Environment.OPERATOR_INSTALL_TYPE.equalsIgnoreCase(InstallTypes.OLM.toString())
&& Objects.requireNonNull(CsvUtils.getOperatorVersionFromCsv()).equals("2.7.0")) {
// https://issues.redhat.com/browse/RHOAIENG-3234 Remove Kueue from RHOAI 2.7
assertNull(cluster.getSpec().getComponents().getKueue());
} else {
assertEquals(Kueue.ManagementState.MANAGED, cluster.getSpec().getComponents().getKueue().getManagementState());
}
assertEquals(Workbenches.ManagementState.MANAGED, cluster.getSpec().getComponents().getWorkbenches().getManagementState());
}

Expand Down
14 changes: 13 additions & 1 deletion src/test/java/io/odh/test/e2e/standard/DataScienceClusterST.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import io.odh.test.TestSuite;
import io.odh.test.framework.manager.ResourceManager;
import io.odh.test.framework.manager.resources.DataScienceClusterResource;
import io.odh.test.install.InstallTypes;
import io.odh.test.utils.CsvUtils;
import io.odh.test.utils.DscUtils;
import io.opendatahub.datasciencecluster.v1.DataScienceCluster;
import io.opendatahub.datasciencecluster.v1.datascienceclusterspec.components.Codeflare;
Expand All @@ -29,7 +31,10 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;

import java.util.Objects;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

@SuiteDoc(
description = @Desc("Verifies simple setup of ODH by spin-up operator, setup DSCI, and setup DSC."),
Expand Down Expand Up @@ -87,6 +92,13 @@ void createDataScienceCluster() {
assertEquals(Workbenches.ManagementState.MANAGED, cluster.getSpec().getComponents().getWorkbenches().getManagementState());
assertEquals(Modelmeshserving.ManagementState.MANAGED, cluster.getSpec().getComponents().getModelmeshserving().getManagementState());
assertEquals(Ray.ManagementState.MANAGED, cluster.getSpec().getComponents().getRay().getManagementState());
assertEquals(Kueue.ManagementState.MANAGED, cluster.getSpec().getComponents().getKueue().getManagementState());
if (!Environment.PRODUCT.equals(Environment.PRODUCT_DEFAULT)
&& Environment.OPERATOR_INSTALL_TYPE.equalsIgnoreCase(InstallTypes.OLM.toString())
&& Objects.requireNonNull(CsvUtils.getOperatorVersionFromCsv()).equals("2.7.0")) {
// https://issues.redhat.com/browse/RHOAIENG-3234 Remove Kueue from RHOAI 2.7
assertNull(cluster.getSpec().getComponents().getKueue());
} else {
assertEquals(Kueue.ManagementState.MANAGED, cluster.getSpec().getComponents().getKueue().getManagementState());
}
}
}

0 comments on commit 1d8c698

Please sign in to comment.