From ff7c93efa259b599df98ef76efba7a4f248d91e9 Mon Sep 17 00:00:00 2001 From: Daniel Horak Date: Wed, 13 Nov 2024 14:55:46 +0100 Subject: [PATCH] configure default value for hosted_odf_registry Signed-off-by: Daniel Horak --- conf/README.md | 2 +- ocs_ci/deployment/hosted_cluster.py | 23 +++++------------------ ocs_ci/ocs/defaults.py | 2 ++ 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/conf/README.md b/conf/README.md index a6a73065e65..c338540ba63 100644 --- a/conf/README.md +++ b/conf/README.md @@ -324,7 +324,7 @@ higher priority). * `cpu_cores_per_hosted_cluster` - number of CPU cores per hosted cluster * `memory_per_hosted_cluster` - amount of memory per hosted cluster * `nodepool_replicas` - number of replicas of nodepool for each cluster - * `hosted_odf_registry` - registry for hosted ODF + * `hosted_odf_registry` - registry for hosted ODF (default: quay.io/rhceph-dev/ocs-registry) * `hosted_odf_version` - version of ODF to be deployed on hosted clusters * `cp_availability_policy` - "HighlyAvailable" or "SingleReplica"; if not provided the default value is "SingleReplica" * `wait_timeout_for_healthy_osd_in_minutes` - timeout waiting for healthy OSDs before continuing upgrade (see https://bugzilla.redhat.com/show_bug.cgi?id=2276694 for more details) diff --git a/ocs_ci/deployment/hosted_cluster.py b/ocs_ci/deployment/hosted_cluster.py index ec59a7742af..8774abffefe 100644 --- a/ocs_ci/deployment/hosted_cluster.py +++ b/ocs_ci/deployment/hosted_cluster.py @@ -14,7 +14,7 @@ from ocs_ci.deployment.metallb import MetalLBInstaller from ocs_ci.framework import config from ocs_ci.helpers import helpers -from ocs_ci.ocs import constants, ocp +from ocs_ci.ocs import constants, defaults, ocp from ocs_ci.ocs.constants import HCI_PROVIDER_CLIENT_PLATFORMS from ocs_ci.ocs.exceptions import ( ProviderModeNotFoundException, @@ -195,18 +195,13 @@ def config_has_hosted_odf_image(self, cluster_name): bool: True if the config has hosted ODF image, False otherwise """ - regestry_exists = ( - config.ENV_DATA.get("clusters") - .get(cluster_name) - .get("hosted_odf_registry", False) - ) version_exists = ( config.ENV_DATA.get("clusters") .get(cluster_name) .get("hosted_odf_version", False) ) - return regestry_exists and version_exists + return version_exists def storage_installation_requested(self, cluster_name): """ @@ -1046,22 +1041,14 @@ def create_catalog_source(self): "OCS version is not set in the config file, should be set in format similar to '4.14.5-8'" "in the 'hosted_odf_version' key in the 'ENV_DATA.clusters.' section of the config file. " ) - if ( - not config.ENV_DATA.get("clusters") - .get(self.name) - .get("hosted_odf_registry") - ): - raise ValueError( - "OCS registry is not set in the config file, should be set in format similar to " - "'quay.io/rhceph-dev/ocs-registry' in the 'hosted_odf_registry' key in the 'ENV_DATA.clusters.' " - "section of the config file. " - ) odf_version = ( config.ENV_DATA.get("clusters").get(self.name).get("hosted_odf_version") ) odf_registry = ( - config.ENV_DATA.get("clusters").get(self.name).get("hosted_odf_registry") + config.ENV_DATA.get("clusters") + .get(self.name) + .get("hosted_odf_registry", defaults.HOSTED_ODF_REGISTRY_DEFAULT) ) logger.info( diff --git a/ocs_ci/ocs/defaults.py b/ocs_ci/ocs/defaults.py index 5a9698923bc..f3c1db7af34 100644 --- a/ocs_ci/ocs/defaults.py +++ b/ocs_ci/ocs/defaults.py @@ -171,3 +171,5 @@ # IBM Cloud IBM_CLOUD_LOAD_BALANCER_QUOTA = 50 IBM_CLOUD_REGIONS = {"us-south", "us-east"} + +HOSTED_ODF_REGISTRY_DEFAULT = "quay.io/rhceph-dev/ocs-registry"