Skip to content

Commit

Permalink
feat: support the necessary configurability for testing odh-nightly b…
Browse files Browse the repository at this point in the history
…uilds

The expected settings for running odh-nightly build,
which is ODH packaged as if it was RHOAI, are something like

```
PRODUCT=odh
DEFAULT_DSCI_NAME=default-dsci

OPERATOR_INSTALL_TYPE=olm
OLM_SOURCE_NAME=rhoai-source
OLM_OPERATOR_NAME=rhods-operator
OLM_OPERATOR_CHANNEL=odh-nightlies
OLM_SOURCE_NAMESPACE=openshift-marketplace
OLM_OPERATOR_VERSION=1.18.0
```
  • Loading branch information
jiridanek committed Jun 27, 2024
1 parent 7c3ec64 commit 2637402
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/main/java/io/odh/test/Environment.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class Environment {
private static final String SKIP_INSTALL_OPERATOR_DEPS_ENV = "SKIP_INSTALL_OPERATOR_DEPS";
private static final String SKIP_INSTALL_OPERATOR_ENV = "SKIP_INSTALL_OPERATOR";
public static final String SKIP_DEPLOY_DSCI_DSC_ENV = "SKIP_DEPLOY_DSCI_DSC";
public static final String DEFAULT_DSCI_NAME_ENV = "DEFAULT_DSCI_NAME";

/**
* Install bundle files
Expand All @@ -62,6 +63,7 @@ public class Environment {
private static final String OLM_SOURCE_NAME_ENV = "OLM_SOURCE_NAME";
private static final String OLM_SOURCE_NAMESPACE_ENV = "OLM_SOURCE_NAMESPACE";
private static final String OLM_OPERATOR_VERSION_ENV = "OLM_OPERATOR_VERSION";
private static final String OLM_OPERATOR_NAME_ENV = "OLM_OPERATOR_NAME";
private static final String OLM_OPERATOR_CHANNEL_ENV = "OLM_OPERATOR_CHANNEL";
private static final String OPERATOR_INSTALL_TYPE_ENV = "OPERATOR_INSTALL_TYPE";
private static final String OLM_UPGRADE_STARTING_VERSION_ENV = "OLM_UPGRADE_STARTING_VERSION";
Expand All @@ -78,6 +80,7 @@ public class Environment {
public static final boolean SKIP_INSTALL_OPERATOR_DEPS = getOrDefault(SKIP_INSTALL_OPERATOR_DEPS_ENV, Boolean::valueOf, false);
public static final boolean SKIP_INSTALL_OPERATOR = getOrDefault(SKIP_INSTALL_OPERATOR_ENV, Boolean::valueOf, false);
public static final boolean SKIP_DEPLOY_DSCI_DSC = getOrDefault(SKIP_DEPLOY_DSCI_DSC_ENV, Boolean::valueOf, false);
public static final String DEFAULT_DSCI_NAME = getOrDefault(DEFAULT_DSCI_NAME_ENV, String::valueOf, OdhConstants.DEFAULT_DSCI_NAME);

// YAML Bundle
public static final String INSTALL_FILE_PATH = getOrDefault(INSTALL_FILE_ENV, TestConstants.LATEST_BUNDLE_DEPLOY_FILE);
Expand All @@ -90,6 +93,7 @@ public class Environment {
public static final String OLM_OPERATOR_CHANNEL = getOrDefault(OLM_OPERATOR_CHANNEL_ENV, OdhConstants.OLM_OPERATOR_CHANNEL);
public static final String OLM_OPERATOR_VERSION = getOrDefault(OLM_OPERATOR_VERSION_ENV, OdhConstants.OLM_OPERATOR_VERSION);
public static final String OLM_UPGRADE_STARTING_VERSION = getOrDefault(OLM_UPGRADE_STARTING_VERSION_ENV, OdhConstants.OLM_UPGRADE_STARTING_OPERATOR_VERSION);
public static final String OLM_OPERATOR_NAME = getOrDefault(OLM_OPERATOR_NAME_ENV, OdhConstants.OLM_OPERATOR_NAME);

public static final String OPERATOR_INSTALL_TYPE = getOrDefault(OPERATOR_INSTALL_TYPE_ENV, InstallTypes.BUNDLE.toString());

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/odh/test/OdhConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ private OdhConstants() { }
public static final String DEFAULT_DSCI_NAME = getOdhOrRhoai("DSCI_NAME", ODH_DSCI_NAME, RHOAI_DSCI_NAME);
public static final String MONITORING_NAMESPACE = getOdhOrRhoai("MONITORING_NAMESPACE", ODH_MONITORING_NAMESPACE, RHOAI_MONITORING_NAMESPACE);
// OLM env variables
public static final String OLM_OPERATOR_NAME = getOdhOrRhoai("OLM_OPERATOR_NAME", ODH_OLM_OPERATOR_NAME, RHOAI_OLM_OPERATOR_NAME);
public static final String OLM_OPERATOR_CHANNEL = getOdhOrRhoai("OLM_OPERATOR_CHANNEL", ODH_OLM_OPERATOR_CHANNEL, RHOAI_OLM_OPERATOR_CHANNEL);
public static final String OLM_OPERATOR_NAME = getOdhOrRhoai("OLM_OPERATOR_NAME", OLM_OPERATOR_CHANNEL.equals("odh-nightlies") ? RHOAI_OLM_OPERATOR_NAME : ODH_OLM_OPERATOR_NAME, RHOAI_OLM_OPERATOR_NAME);
public static final String OLM_OPERATOR_NAMESPACE = getOdhOrRhoai("OLM_OPERATOR_NAMESPACE", ODH_OLM_OPERATOR_NAMESPACE, RHOAI_OLM_OPERATOR_NAMESPACE);
public static final String OLM_OPERATOR_DEPLOYMENT_NAME = getOdhOrRhoai("OLM_OPERATOR_DEPLOYMENT_NAME", ODH_OLM_OPERATOR_DEPLOYMENT_NAME, RHOAI_OLM_OPERATOR_DEPLOYMENT_NAME);
public static final String OLM_APP_BUNDLE_PREFIX = getOdhOrRhoai("OLM_APP_BUNDLE_PREFIX", ODH_OLM_APP_BUNDLE_PREFIX, RHOAI_OLM_APP_BUNDLE_PREFIX);
public static final String OLM_OPERATOR_VERSION = getOdhOrRhoai("OLM_OPERATOR_VERSION", ODH_OLM_OPERATOR_VERSION, RHOAI_OLM_OPERATOR_VERSION);
public static final String OLM_SOURCE_NAME = getOdhOrRhoai("OLM_SOURCE_NAME", ODH_OLM_SOURCE_NAME, RHOAI_OLM_SOURCE_NAME);
public static final String OLM_OPERATOR_CHANNEL = getOdhOrRhoai("OLM_OPERATOR_CHANNEL", ODH_OLM_OPERATOR_CHANNEL, RHOAI_OLM_OPERATOR_CHANNEL);
public static final String OLM_UPGRADE_STARTING_OPERATOR_VERSION = getOdhOrRhoai("OLM_UPGRADE_STARTING_OPERATOR_VERSION", ODH_OLM_UPGRADE_STARTING_OPERATOR_VERSION, RHOAI_OLM_UPGRADE_STARTING_OPERATOR_VERSION);

private static <T> T getOdhOrRhoai(String var, T odhValue, T rhoaiValue) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/io/odh/test/install/OlmInstall.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public class OlmInstall {

private String namespace = OdhConstants.OLM_OPERATOR_NAMESPACE;
private String channel = Environment.OLM_OPERATOR_CHANNEL;
private String name = OdhConstants.OLM_OPERATOR_NAME;
private String operatorName = OdhConstants.OLM_OPERATOR_NAME;
private String name = Environment.OLM_OPERATOR_NAME;
private String operatorName = Environment.OLM_OPERATOR_NAME;
private String sourceName = Environment.OLM_SOURCE_NAME;
private String sourceNamespace = Environment.OLM_SOURCE_NAMESPACE;
private String startingCsv;
private String deploymentName = OdhConstants.OLM_OPERATOR_DEPLOYMENT_NAME;
private String olmAppBundlePrefix = OdhConstants.OLM_OPERATOR_NAME;
private String olmAppBundlePrefix = Environment.OLM_OPERATOR_NAME;
private String operatorVersion = Environment.OLM_OPERATOR_VERSION;
private String csvName = operatorName + "." + operatorVersion;

Expand Down Expand Up @@ -61,7 +61,7 @@ public void createManual() {
* Creates namespace for operator-group and subscription
*/
private void createNamespace() {
// Create namespace at first because operator-group and subscription could you specific namespace
// Create a namespace first because operator-group and subscription could use specific namespace
Namespace ns = new NamespaceBuilder()
.withNewMetadata()
.withName(namespace)
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/odh/test/utils/DscUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
package io.odh.test.utils;

import io.odh.test.Environment;
import io.odh.test.OdhConstants;
import io.odh.test.framework.manager.requirements.ServiceMeshOperator;
import io.opendatahub.datasciencecluster.v1.DataScienceCluster;
Expand Down Expand Up @@ -37,7 +38,7 @@ public class DscUtils {
public static DSCInitialization getBasicDSCI() {
return new DSCInitializationBuilder()
.withNewMetadata()
.withName(OdhConstants.DEFAULT_DSCI_NAME)
.withName(Environment.DEFAULT_DSCI_NAME)
.endMetadata()
.withNewSpec()
.withApplicationsNamespace(OdhConstants.CONTROLLERS_NAMESPACE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ void createDataScienceCluster() {
// Create DSC
DataScienceCluster c = DscUtils.getBasicDSC(DS_PROJECT_NAME);

KubeResourceManager.getInstance().createResourceWithWait(dsci);
// odh-nightly gives us a default DSCi, update that
KubeResourceManager.getInstance().createOrUpdateResourceWithWait(dsci);
KubeResourceManager.getInstance().createResourceWithWait(c);

DataScienceCluster cluster = DataScienceClusterType.dataScienceCLusterClient().withName(DS_PROJECT_NAME).get();
Expand Down

0 comments on commit 2637402

Please sign in to comment.