From c57871e1d1eb1b1c0aac5a8ca11b488dc46ecdb1 Mon Sep 17 00:00:00 2001 From: Amrita Mahapatra <49347640+amr1ta@users.noreply.github.com> Date: Mon, 6 Jan 2025 13:53:42 +0530 Subject: [PATCH] Addressed review comments and synced the branch with master Signed-off-by: Amrita Mahapatra <49347640+amr1ta@users.noreply.github.com> --- ocs_ci/deployment/mce.py | 32 ++++++++----------- .../mce-deployment/image-override.json | 2 +- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/ocs_ci/deployment/mce.py b/ocs_ci/deployment/mce.py index 9e472c5736e..624cc16dfe9 100644 --- a/ocs_ci/deployment/mce.py +++ b/ocs_ci/deployment/mce.py @@ -17,6 +17,7 @@ from ocs_ci.ocs.resources.catalog_source import CatalogSource from ocs_ci.ocs import ocp from ocs_ci.utility.utils import get_running_ocp_version +from ocs_ci.ocs.exceptions import CommandFailed, UnavailableResourceException logger = logging.getLogger(__name__) @@ -165,9 +166,12 @@ def check_supported_versions(self): namespace=constants.HYPERSHIFT_NAMESPACE, ) - assert configmaps_obj.is_exist( + if not configmaps_obj.is_exist( resource_name=constants.SUPPORTED_VERSIONS_CONFIGMAP - ), f"Configmap {constants.SUPPORTED_VERSIONS_CONFIGMAP} does not exist in hypershift namespace" + ): + raise UnavailableResourceException( + f"Configmap {constants.SUPPORTED_VERSIONS_CONFIGMAP} does not exist in hypershift namespace" + ) cmd = "oc get cm -n hypershift supported-versions -o jsonpath='{.data.supported-versions}'" cmd_res = exec_cmd(cmd, shell=True) @@ -188,16 +192,8 @@ def create_image_override(self): "-n {self.namespace}" ) cmd_res = exec_cmd(cmd, shell=True) - assert cmd_res.returncode == 0 - - configmaps_obj = OCP( - kind=constants.CONFIGMAP, - namespace=constants.HYPERSHIFT_NAMESPACE, - ) - - assert configmaps_obj.is_exist( - resource_name=self.hypershift_override_image_cm - ), f"Configmap {self.hypershift_override_image_cm} does not exist in hypershift namespace" + if cmd_res.returncode: + raise CommandFailed("override configmap not created successfully") # annotate multicluster engine operator with the override cm self.multicluster_engine.annotate( @@ -236,11 +232,9 @@ def deploy_mce(self, check_mce_deployed=False, check_mce_ready=False): self.create_multiclusterengine_operator() # Check hypershift ns created if not self.check_hypershift_namespace(): - cmd = ( - "oc patch mce multiclusterengine " - '-p \'{"spec":{"overrides":{"components":[' - '{"enabled":true, "name":"hypershift"}' - "]}}}' --type=merge" - ) + cmd = f"oc create namespace {constants.HYPERSHIFT_NAMESPACE}" cmd_res = exec_cmd(cmd, shell=True) - assert cmd_res.returncode == 0 + if cmd_res.returncode: + raise CommandFailed("Failed to create hypershift namespace") + # Check supported versions in supported-versions configmap + self.check_supported_versions() diff --git a/ocs_ci/templates/mce-deployment/image-override.json b/ocs_ci/templates/mce-deployment/image-override.json index 724a4e68445..5c8fe6d8718 100644 --- a/ocs_ci/templates/mce-deployment/image-override.json +++ b/ocs_ci/templates/mce-deployment/image-override.json @@ -1,7 +1,7 @@ [ { "image-name": "rhtap-hypershift-operator", - "image-tag": "17a958f", + "image-tag": "latest", "image-remote": "quay.io/acm-d", "image-key": "hypershift_operator" }