Skip to content

Commit

Permalink
Addressed review comments and synced the branch with master
Browse files Browse the repository at this point in the history
Signed-off-by: Amrita Mahapatra <[email protected]>
  • Loading branch information
amr1ta committed Jan 6, 2025
1 parent 9cfe114 commit c57871e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
32 changes: 13 additions & 19 deletions ocs_ci/deployment/mce.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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)
Expand All @@ -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(
Expand Down Expand Up @@ -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()
2 changes: 1 addition & 1 deletion ocs_ci/templates/mce-deployment/image-override.json
Original file line number Diff line number Diff line change
@@ -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"
}
Expand Down

0 comments on commit c57871e

Please sign in to comment.