Skip to content

Commit

Permalink
Update StorageCluster based on globalnet flag
Browse files Browse the repository at this point in the history
Signed-off-by: Shylesh Kumar Mohan <[email protected]>
  • Loading branch information
shylesh committed Oct 26, 2023
1 parent 689db13 commit bd7f883
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions ocs_ci/deployment/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
ocs_install_verification,
setup_ceph_debug,
get_osd_count,
StorageCluster,
verify_storage_cluster,
)
from ocs_ci.ocs.uninstall import uninstall_ocs
from ocs_ci.ocs.utils import (
Expand Down Expand Up @@ -351,6 +353,41 @@ def do_deploy_ocs(self):
"ocs_registry_image", None
)
ocs_install_verification(ocs_registry_image=ocs_registry_image)
# if we have Globalnet enabled in case of submariner with RDR
# we need to add a flag to storagecluster
if config.ENV_DATA.get("enable_globalnet", None):
for cluster in get_non_acm_cluster_config():
config.switch_ctx(cluster.MULTICLUSTER["multicluster_index"])
storage_cluster_name = config.ENV_DATA["storage_cluster_name"]
logger.info(
"Updating the StorageCluster resource for globalnet"
)
storage_cluster = StorageCluster(
resource_name=storage_cluster_name,
namespace=config.ENV_DATA["cluster_namespace"],
)
storage_cluster.reload_data()
storage_cluster.wait_for_phase(phase="Ready", timeout=1000)
multicluster_service = {
"network": {
"multiClusterService": {
"clusterID": config.ENV_DATA["cluster_name"],
"enabled": "true",
}
}
}
storage_cluster.data.get("spec").merge_dict(
multicluster_service
)
# todo: oc apply updated resource
storage_cluster_yaml = tempfile.NamedTemporaryFile(
mode="w+", prefix="storageclusterupdate", delete=False
)
templating.dump_data_to_temp_yaml(
storage_cluster.data, storage_cluster_yaml.name
)
run_cmd(f"oc apply -f {storage_cluster.name}", timeout=300)
verify_storage_cluster()
config.reset_ctx()
else:
logger.warning("OCS deployment will be skipped")
Expand Down

0 comments on commit bd7f883

Please sign in to comment.