diff --git a/ocs_ci/deployment/deployment.py b/ocs_ci/deployment/deployment.py index b1914145aec..cbb81e7865d 100644 --- a/ocs_ci/deployment/deployment.py +++ b/ocs_ci/deployment/deployment.py @@ -374,6 +374,12 @@ def post_ocp_deploy(self): enable_huge_pages() if config.DEPLOYMENT.get("dummy_zone_node_labels"): create_dummy_zone_labels() + ibmcloud_ipi = ( + config.ENV_DATA["platform"] == constants.IBMCLOUD_PLATFORM + and config.ENV_DATA["deployment_type"] == "ipi" + ) + if ibmcloud_ipi: + ibmcloud.label_nodes_region() def label_and_taint_nodes(self): """ @@ -692,6 +698,7 @@ def deploy_ocs_via_operator(self, image=None): ibmcloud.add_deployment_dependencies() if not live_deployment: create_ocs_secret(self.namespace) + if config.ENV_DATA["platform"] == constants.IBMCLOUD_PLATFORM: if config.DEPLOYMENT.get("create_ibm_cos_secret", True): logger.info("Creating secret for IBM Cloud Object Storage") with open(constants.IBM_COS_SECRET_YAML, "r") as cos_secret_fd: diff --git a/ocs_ci/utility/ibmcloud.py b/ocs_ci/utility/ibmcloud.py index 3bf12d11d85..62a2e5f7685 100644 --- a/ocs_ci/utility/ibmcloud.py +++ b/ocs_ci/utility/ibmcloud.py @@ -518,3 +518,16 @@ def delete_volume_id(self, volume): logger.info(f"volume is deleted successfully: {volume}") else: logger.info("volume is not deleted") + + +def label_nodes_region(): + """ + Apply the region label to the worker nodes. + Necessary for IBM COS-backed backingstore support. + + """ + logger.info("Applying region label to worker nodes") + region = config.ENV_DATA.get("region") + worker_nodes = get_nodes(node_type=constants.WORKER_MACHINE) + for node in worker_nodes: + node.add_label(rf"ibm-cloud\.kubernetes\.io/region={region}")