From c530bcce978d553a2e8fcd1e417175775b65f081 Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Wed, 4 Dec 2024 09:34:09 +0100 Subject: [PATCH 01/16] Update ibm cloud roks zone key In RDR deployment, the zone key in ENV_DATA is used for different purpose, so changing it to worker_availability_zone here. Signed-off-by: Petr Balogh --- .../ibmcloud/ibm_cloud_managed_3az_0m_3w_vpc_cluster.yaml | 2 +- conf/deployment/ibmcloud/ibm_cloud_vpc_cluster.yaml | 2 +- .../ibmcloud/ibm_cloud_vpc_cluster_hpcs_external.yaml | 2 +- conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_stage.yaml | 2 +- conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos.yaml | 2 +- .../ibmcloud/ibm_cloud_vpc_cluster_without_cos_stage.yaml | 2 +- ocs_ci/utility/ibmcloud.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/conf/deployment/ibmcloud/ibm_cloud_managed_3az_0m_3w_vpc_cluster.yaml b/conf/deployment/ibmcloud/ibm_cloud_managed_3az_0m_3w_vpc_cluster.yaml index c96c095e5d9..d75ed67f2da 100644 --- a/conf/deployment/ibmcloud/ibm_cloud_managed_3az_0m_3w_vpc_cluster.yaml +++ b/conf/deployment/ibmcloud/ibm_cloud_managed_3az_0m_3w_vpc_cluster.yaml @@ -5,7 +5,7 @@ ENV_DATA: platform: 'ibm_cloud' deployment_type: 'managed' region: 'eu-de' - zone: 'eu-de-3' + worker_availability_zone: 'eu-de-3' provider: "vpc-gen2" worker_instance_type: "bx2.16x64" master_replicas: 0 diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster.yaml index 8f3b4044b08..4ce75f9ccd8 100644 --- a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster.yaml +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster.yaml @@ -5,7 +5,7 @@ ENV_DATA: platform: 'ibm_cloud' deployment_type: 'managed' region: 'eu-de' - zone: 'eu-de-3' + worker_availability_zone: 'eu-de-3' provider: "vpc-gen2" worker_instance_type: "bx2.16x64" master_replicas: 0 diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_hpcs_external.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_hpcs_external.yaml index 7f4992d123b..56d93d528a3 100644 --- a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_hpcs_external.yaml +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_hpcs_external.yaml @@ -7,7 +7,7 @@ ENV_DATA: platform: 'ibm_cloud' deployment_type: 'managed' region: 'eu-de' - zone: 'eu-de-3' + worker_availability_zone: 'eu-de-3' provider: "vpc-gen2" worker_instance_type: "bx2.16x64" master_replicas: 0 diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_stage.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_stage.yaml index 15b92e651ab..037bad5a5bd 100644 --- a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_stage.yaml +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_stage.yaml @@ -5,7 +5,7 @@ ENV_DATA: platform: 'ibm_cloud' deployment_type: 'managed' region: 'us-south' - zone: 'us-south-1' + worker_availability_zone: 'us-south-1' provider: "vpc-gen2" worker_instance_type: "bx2.16x64" master_replicas: 0 diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos.yaml index 3cbd5807eaa..347e9986bc4 100644 --- a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos.yaml +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos.yaml @@ -7,7 +7,7 @@ ENV_DATA: platform: 'ibm_cloud' deployment_type: 'managed' region: 'eu-de' - zone: 'eu-de-3' + worker_availability_zone: 'eu-de-3' provider: "vpc-gen2" worker_instance_type: "bx2.16x64" master_replicas: 0 diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos_stage.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos_stage.yaml index cbac6d55ff9..dab74f17f71 100644 --- a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos_stage.yaml +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos_stage.yaml @@ -8,7 +8,7 @@ ENV_DATA: platform: 'ibm_cloud' deployment_type: 'managed' region: 'us-south' - zone: 'us-south-1' + worker_availability_zone: 'us-south-1' provider: "vpc-gen2" worker_instance_type: "bx2.16x64" master_replicas: 0 diff --git a/ocs_ci/utility/ibmcloud.py b/ocs_ci/utility/ibmcloud.py index 12731c6d967..fef3c2f29c1 100644 --- a/ocs_ci/utility/ibmcloud.py +++ b/ocs_ci/utility/ibmcloud.py @@ -192,7 +192,7 @@ def create_cluster(cluster_name): provider = config.ENV_DATA["provider"] worker_availability_zones = config.ENV_DATA.get("worker_availability_zones", []) worker_zones_number = len(worker_availability_zones) - zone = config.ENV_DATA["zone"] + zone = config.ENV_DATA["worker_availability_zone"] flavor = config.ENV_DATA["worker_instance_type"] worker_replicas = config.ENV_DATA["worker_replicas"] if worker_zones_number > 1: From 06d98bfa0fd1a36ff36ad8f0b35b582751964970 Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Wed, 4 Dec 2024 09:37:19 +0100 Subject: [PATCH 02/16] Add ibm cloud roks config for 3 different zones Signed-off-by: Petr Balogh --- .../ibm_cloud_vpc_cluster_zone_eu_de_1.yaml | 28 +++++++++++++++++++ .../ibm_cloud_vpc_cluster_zone_eu_de_2.yaml | 28 +++++++++++++++++++ .../ibm_cloud_vpc_cluster_zone_eu_de_3.yaml | 28 +++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_1.yaml create mode 100644 conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_2.yaml create mode 100644 conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_3.yaml diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_1.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_1.yaml new file mode 100644 index 00000000000..e2b6b6aa442 --- /dev/null +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_1.yaml @@ -0,0 +1,28 @@ + +# This is the basic config for IBM cloud usage +--- +ENV_DATA: + platform: 'ibm_cloud' + deployment_type: 'managed' + region: 'eu-de' + worker_availability_zone: 'eu-de-1' + provider: "vpc-gen2" + worker_instance_type: "bx2.16x64" + master_replicas: 0 + worker_replicas: 3 + worker_availability_zones: + - 'eu-de-1' + rhel_workers: true + # Following values needs to be set in separate config and passed to ocs-ci in + # order to deploy OCP/OCS cluster on IBM Cloud + # vpc_id: VPC ID PLACEHOLDER + # subnet_id: SUBNET ID PLACEHOLDER + # cos_instance: COS INSTANCE PLACEHOLDER +#AUTH: +# ibmcloud: +# api_key: IBM CLOUD API KEY PLACEHOLDER +# account_id: ACCOUNT ID PLACEHOLDER +# ibm_cos_access_key_id: KEY PLACEHOLDER +# ibm_cos_secret_access_key: SECRET PLACEHOLDER +#DEPLOYMENT: +# ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_2.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_2.yaml new file mode 100644 index 00000000000..da25b14df7e --- /dev/null +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_2.yaml @@ -0,0 +1,28 @@ + +# This is the basic config for IBM cloud usage +--- +ENV_DATA: + platform: 'ibm_cloud' + deployment_type: 'managed' + region: 'eu-de' + worker_availability_zone: 'eu-de-2' + provider: "vpc-gen2" + worker_instance_type: "bx2.16x64" + master_replicas: 0 + worker_replicas: 3 + worker_availability_zones: + - 'eu-de-2' + rhel_workers: true + # Following values needs to be set in separate config and passed to ocs-ci in + # order to deploy OCP/OCS cluster on IBM Cloud + # vpc_id: VPC ID PLACEHOLDER + # subnet_id: SUBNET ID PLACEHOLDER + # cos_instance: COS INSTANCE PLACEHOLDER +#AUTH: +# ibmcloud: +# api_key: IBM CLOUD API KEY PLACEHOLDER +# account_id: ACCOUNT ID PLACEHOLDER +# ibm_cos_access_key_id: KEY PLACEHOLDER +# ibm_cos_secret_access_key: SECRET PLACEHOLDER +#DEPLOYMENT: +# ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_3.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_3.yaml new file mode 100644 index 00000000000..4ce75f9ccd8 --- /dev/null +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_3.yaml @@ -0,0 +1,28 @@ + +# This is the basic config for IBM cloud usage +--- +ENV_DATA: + platform: 'ibm_cloud' + deployment_type: 'managed' + region: 'eu-de' + worker_availability_zone: 'eu-de-3' + provider: "vpc-gen2" + worker_instance_type: "bx2.16x64" + master_replicas: 0 + worker_replicas: 3 + worker_availability_zones: + - 'eu-de-3' + rhel_workers: true + # Following values needs to be set in separate config and passed to ocs-ci in + # order to deploy OCP/OCS cluster on IBM Cloud + # vpc_id: VPC ID PLACEHOLDER + # subnet_id: SUBNET ID PLACEHOLDER + # cos_instance: COS INSTANCE PLACEHOLDER +#AUTH: +# ibmcloud: +# api_key: IBM CLOUD API KEY PLACEHOLDER +# account_id: ACCOUNT ID PLACEHOLDER +# ibm_cos_access_key_id: KEY PLACEHOLDER +# ibm_cos_secret_access_key: SECRET PLACEHOLDER +#DEPLOYMENT: +# ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER From b6914634816785d0871be3e64c1d7625b26ab028 Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Wed, 4 Dec 2024 12:31:39 +0100 Subject: [PATCH 03/16] Take zone from subnet_ids_per_zone if available Signed-off-by: Petr Balogh --- ocs_ci/utility/ibmcloud.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ocs_ci/utility/ibmcloud.py b/ocs_ci/utility/ibmcloud.py index fef3c2f29c1..522e228f544 100644 --- a/ocs_ci/utility/ibmcloud.py +++ b/ocs_ci/utility/ibmcloud.py @@ -211,7 +211,10 @@ def create_cluster(cluster_name): if semantic_ocp_version >= util_version.VERSION_4_15: cmd += " --disable-outbound-traffic-protection" vpc_id = config.ENV_DATA["vpc_id"] - subnet_id = config.ENV_DATA["subnet_id"] + subnet_id = config.ENV_DATA.get("subnet_id") + subnet_ids_per_zone = config.ENV_DATA.get("subnet_ids_per_zone", {}).get(zone) + if subnet_ids_per_zone: + subnet_id = subnet_ids_per_zone cmd += f" --vpc-id {vpc_id} --subnet-id {subnet_id} --zone {zone}" cos_instance = config.ENV_DATA["cos_instance"] cmd += f" --cos-instance {cos_instance}" From c8e0ca5d6321302251f61739bf42454b5052c40a Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Wed, 4 Dec 2024 12:48:36 +0100 Subject: [PATCH 04/16] Add cnv_latest_stable to IBM ROKS config files Signed-off-by: Petr Balogh --- .../ibmcloud/ibm_cloud_managed_3az_0m_3w_vpc_cluster.yaml | 5 +++-- conf/deployment/ibmcloud/ibm_cloud_vpc_cluster.yaml | 5 +++-- .../ibmcloud/ibm_cloud_vpc_cluster_hpcs_external.yaml | 8 ++++---- conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_stage.yaml | 5 +++-- .../ibmcloud/ibm_cloud_vpc_cluster_without_cos.yaml | 8 ++++---- .../ibmcloud/ibm_cloud_vpc_cluster_without_cos_stage.yaml | 8 ++++---- .../ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_1.yaml | 5 +++-- .../ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_2.yaml | 5 +++-- .../ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_3.yaml | 5 +++-- 9 files changed, 30 insertions(+), 24 deletions(-) diff --git a/conf/deployment/ibmcloud/ibm_cloud_managed_3az_0m_3w_vpc_cluster.yaml b/conf/deployment/ibmcloud/ibm_cloud_managed_3az_0m_3w_vpc_cluster.yaml index d75ed67f2da..89c1b3b97e4 100644 --- a/conf/deployment/ibmcloud/ibm_cloud_managed_3az_0m_3w_vpc_cluster.yaml +++ b/conf/deployment/ibmcloud/ibm_cloud_managed_3az_0m_3w_vpc_cluster.yaml @@ -26,5 +26,6 @@ ENV_DATA: # account_id: ACCOUNT ID PLACEHOLDER # ibm_cos_access_key_id: KEY PLACEHOLDER # ibm_cos_secret_access_key: SECRET PLACEHOLDER -#DEPLOYMENT: -# ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER +DEPLOYMENT: + cnv_latest_stable: true + # ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster.yaml index 4ce75f9ccd8..c5755b4a879 100644 --- a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster.yaml +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster.yaml @@ -24,5 +24,6 @@ ENV_DATA: # account_id: ACCOUNT ID PLACEHOLDER # ibm_cos_access_key_id: KEY PLACEHOLDER # ibm_cos_secret_access_key: SECRET PLACEHOLDER -#DEPLOYMENT: -# ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER +DEPLOYMENT: + cnv_latest_stable: true + # ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_hpcs_external.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_hpcs_external.yaml index 56d93d528a3..02efa9d76e4 100644 --- a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_hpcs_external.yaml +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_hpcs_external.yaml @@ -1,7 +1,5 @@ # This is the basic config for IBM cloud usage with HPCS. -DEPLOYMENT: - kms_deployment: true --- ENV_DATA: platform: 'ibm_cloud' @@ -28,5 +26,7 @@ ENV_DATA: # account_id: ACCOUNT ID PLACEHOLDER # ibm_cos_access_key_id: KEY PLACEHOLDER # ibm_cos_secret_access_key: SECRET PLACEHOLDER -#DEPLOYMENT: -# ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER +DEPLOYMENT: + kms_deployment: true + cnv_latest_stable: true + # ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_stage.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_stage.yaml index 037bad5a5bd..3dc9ee82f2a 100644 --- a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_stage.yaml +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_stage.yaml @@ -23,5 +23,6 @@ AUTH: # account_id: ACCOUNT ID PLACEHOLDER # ibm_cos_access_key_id: KEY PLACEHOLDER # ibm_cos_secret_access_key: SECRET PLACEHOLDER -#DEPLOYMENT: -# ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER +DEPLOYMENT: + cnv_latest_stable: true + # ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos.yaml index 347e9986bc4..c3dcde5dd46 100644 --- a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos.yaml +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos.yaml @@ -1,8 +1,6 @@ # This is the basic config for IBM cloud usage without COS secret created. --- -DEPLOYMENT: - create_ibm_cos_secret: False ENV_DATA: platform: 'ibm_cloud' deployment_type: 'managed' @@ -24,5 +22,7 @@ ENV_DATA: # account_id: ACCOUNT ID PLACEHOLDER # ibm_cos_access_key_id: KEY PLACEHOLDER # ibm_cos_secret_access_key: SECRET PLACEHOLDER -#DEPLOYMENT: -# ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER +DEPLOYMENT: + create_ibm_cos_secret: False + cnv_latest_stable: true + # ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos_stage.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos_stage.yaml index dab74f17f71..f1d9d022c12 100644 --- a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos_stage.yaml +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_without_cos_stage.yaml @@ -2,8 +2,6 @@ # This is the basic config for IBM cloud usage without COS secret created for # stage env. --- -DEPLOYMENT: - create_ibm_cos_secret: False ENV_DATA: platform: 'ibm_cloud' deployment_type: 'managed' @@ -26,5 +24,7 @@ AUTH: # account_id: ACCOUNT ID PLACEHOLDER # ibm_cos_access_key_id: KEY PLACEHOLDER # ibm_cos_secret_access_key: SECRET PLACEHOLDER -#DEPLOYMENT: -# ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER +DEPLOYMENT: + create_ibm_cos_secret: False + cnv_latest_stable: true + # ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_1.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_1.yaml index e2b6b6aa442..24639b25ca5 100644 --- a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_1.yaml +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_1.yaml @@ -24,5 +24,6 @@ ENV_DATA: # account_id: ACCOUNT ID PLACEHOLDER # ibm_cos_access_key_id: KEY PLACEHOLDER # ibm_cos_secret_access_key: SECRET PLACEHOLDER -#DEPLOYMENT: -# ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER +DEPLOYMENT: + cnv_latest_stable: true + # ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_2.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_2.yaml index da25b14df7e..f4cfaea29d1 100644 --- a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_2.yaml +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_2.yaml @@ -24,5 +24,6 @@ ENV_DATA: # account_id: ACCOUNT ID PLACEHOLDER # ibm_cos_access_key_id: KEY PLACEHOLDER # ibm_cos_secret_access_key: SECRET PLACEHOLDER -#DEPLOYMENT: -# ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER +DEPLOYMENT: + cnv_latest_stable: true + # ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_3.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_3.yaml index 4ce75f9ccd8..c5755b4a879 100644 --- a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_3.yaml +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_eu_de_3.yaml @@ -24,5 +24,6 @@ ENV_DATA: # account_id: ACCOUNT ID PLACEHOLDER # ibm_cos_access_key_id: KEY PLACEHOLDER # ibm_cos_secret_access_key: SECRET PLACEHOLDER -#DEPLOYMENT: -# ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER +DEPLOYMENT: + cnv_latest_stable: true + # ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER From f25d9b220c335b3eebbc81f3ecf957035ed0220a Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Wed, 4 Dec 2024 14:20:47 +0100 Subject: [PATCH 05/16] Add retry logic for donwload virtctl Signed-off-by: Petr Balogh --- ocs_ci/deployment/cnv.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ocs_ci/deployment/cnv.py b/ocs_ci/deployment/cnv.py index 7b730bc8e37..6bedc31330d 100644 --- a/ocs_ci/deployment/cnv.py +++ b/ocs_ci/deployment/cnv.py @@ -32,6 +32,7 @@ from ocs_ci.ocs.resources.catalog_source import CatalogSource from ocs_ci.ocs.resources.install_plan import wait_for_install_plan_and_approve from ocs_ci.ocs.resources.csv import CSV, get_csvs_start_with_prefix +from ocs_ci.utility.retry import retry from ocs_ci.utility.utils import TimeoutSampler from ocs_ci.ocs import ocp from ocs_ci.ocs.resources.pod import wait_for_pods_to_be_running @@ -539,7 +540,9 @@ def _download_virtctl_archive(self, os_type, os_machine_type): ) try: # Download the archive - response = requests.get(virtctl_download_url, verify=False) + response = retry(requests.exceptions.RequestException, tries=10, delay=30)( + requests.get + )(virtctl_download_url, verify=False) response.raise_for_status() except requests.exceptions.RequestException as e: logger.error( From befb1d6c1be62578ab3943545dab11db84a18c40 Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Wed, 4 Dec 2024 16:27:22 +0100 Subject: [PATCH 06/16] Introduce run_for_all_clusters wrapper run_for_all_clusters allow to run existing function on all cluster configs. It's usefull when you need to globally update some config value for all clusters. Signed-off-by: Petr Balogh --- ocs_ci/framework/__init__.py | 16 ++++++++++++++++ ocs_ci/utility/reporting.py | 1 + 2 files changed, 17 insertions(+) diff --git a/ocs_ci/framework/__init__.py b/ocs_ci/framework/__init__.py index 4e61f85c14f..0a5f1a0fceb 100644 --- a/ocs_ci/framework/__init__.py +++ b/ocs_ci/framework/__init__.py @@ -8,6 +8,7 @@ """ # Use the new python 3.7 dataclass decorator, which provides an object similar # to a namedtuple, but allows type enforcement and defining methods. +import functools import os import yaml import logging @@ -451,6 +452,21 @@ def switch_to_cluster_by_cluster_type(self, cluster_type, num_of_cluster=0): self.get_cluster_type_indices_list(cluster_type)[num_of_cluster] ) + def run_for_all_clusters(self, func): + """ + A decorator to run the decorated function for all clusters + and switch context between them. + """ + + @functools.wraps(func) + def wrapper(*args, **kwargs): + for cluster_index in range(self.nclusters): + self.switch_ctx(cluster_index) + logger.info(f"Running '{func.__name__}' for cluster {cluster_index}") + func(*args, **kwargs) + + return wrapper + class RunWithConfigContext(object): def __init__(self, config_index): self.original_config_index = config.cur_index diff --git a/ocs_ci/utility/reporting.py b/ocs_ci/utility/reporting.py index b884617ea17..e08f2230e11 100644 --- a/ocs_ci/utility/reporting.py +++ b/ocs_ci/utility/reporting.py @@ -114,6 +114,7 @@ def get_rp_launch_description(): return description +@config.run_for_all_clusters def update_live_must_gather_image(): """ Update live must gather image in the config. From e1266635359223fea0913f08ef3122e61223c3ec Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Sat, 7 Dec 2024 23:32:37 +0100 Subject: [PATCH 07/16] UI Login for IBM Cloud Managed - ROKS Signed-off-by: Petr Balogh --- ocs_ci/ocs/ui/base_ui.py | 49 +++++++++++++++++++++++++++++++++++++++- ocs_ci/ocs/ui/views.py | 18 +++++++++++++++ setup.py | 1 + 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/ocs_ci/ocs/ui/base_ui.py b/ocs_ci/ocs/ui/base_ui.py index 0684f12faa8..f6d408cd953 100644 --- a/ocs_ci/ocs/ui/base_ui.py +++ b/ocs_ci/ocs/ui/base_ui.py @@ -6,6 +6,8 @@ import time import zipfile from functools import reduce + +import pyotp from selenium import webdriver from selenium.common.exceptions import ( TimeoutException, @@ -903,6 +905,21 @@ def remove_instance(cls): logger.info("SeleniumDriver instance attr not found") +def generate_otp_token(secret): + """ + Generate OTP token for specific OTP secret + + Args: + secret (string): OTP secret phrase + + Returns: + str: OTP token + + """ + totp = pyotp.TOTP(secret) + return totp.now() + + @retry( exception_to_check=(TimeoutException, WebDriverException, AttributeError), tries=3, @@ -910,7 +927,7 @@ def remove_instance(cls): backoff=2, func=garbage_collector_webdriver, ) -def login_ui(console_url=None, username=None, password=None, **kwargs): +def login_ui(console_url=None, username=None, password=None, otp_secret=None, **kwargs): """ Login to OpenShift Console @@ -918,11 +935,21 @@ def login_ui(console_url=None, username=None, password=None, **kwargs): console_url (str): ocp console url username(str): User which is other than admin user, password(str): Password of user other than admin user + otp_secret(str): Secret for OTP 2F authentication from which we generate token return: driver (Selenium WebDriver) """ + ibm_cloud_managed = ( + config.ENV_DATA["platform"] == constants.IBMCLOUD_PLATFORM + and config.ENV_DATA["deployment_type"] == "managed" + ) + if ibm_cloud_managed: + # Those data are required for UI testing for IBM Managed ROKS + username = config.AUTH["ibmcloud"]["username"] + password = config.AUTH["ibmcloud"]["password"] + otp_secret = config.AUTH["ibmcloud"]["otp_secret"] default_console = False if not console_url: console_url = get_ocp_url() @@ -940,6 +967,26 @@ def login_ui(console_url=None, username=None, password=None, **kwargs): driver.get(console_url) # Validate proceeding to the login console before taking any action: proceed_to_login_console() + if ibm_cloud_managed: + username_el = wait_for_element_to_be_clickable(login_loc["username"], 60) + username_el.send_keys(username) + continue_login_el = wait_for_element_to_be_clickable( + login_loc["continue_button"], 60 + ) + continue_login_el.click() + password_el = wait_for_element_to_be_clickable(login_loc["password"], 60) + password_el.send_keys(password) + click_login_el = wait_for_element_to_be_clickable(login_loc["click_login"], 60) + click_login_el.click() + login_2fa_input_el = wait_for_element_to_be_clickable( + login_loc["login_2fa_input"], 60 + ) + login_2fa_input_el.send_keys(generate_otp_token(otp_secret)) + click_2fa_verify_el = wait_for_element_to_be_clickable( + login_loc["login_2fa_verify"], 60 + ) + click_2fa_verify_el.click() + return driver try: wait = WebDriverWait(driver, 15) diff --git a/ocs_ci/ocs/ui/views.py b/ocs_ci/ocs/ui/views.py index 2959a9ab445..3aa4ad11f3f 100644 --- a/ocs_ci/ocs/ui/views.py +++ b/ocs_ci/ocs/ui/views.py @@ -24,6 +24,24 @@ ), "skip_tour": ('button[data-test="tour-step-footer-secondary"]', By.CSS_SELECTOR), } + +ibm_cloud_managed = ( + config.ENV_DATA["platform"] == constants.IBMCLOUD_PLATFORM + and config.ENV_DATA["deployment_type"] == "managed" +) +login_ibm_cloud = { + "continue_button": ("continue-button", By.ID), + "login_page_title": "IBMid - Sign in or create an IBMid", + "login_2fa_input": ("mfa-authenticate-totp-input-verification-code", By.ID), + "login_2fa_verify": ("mfa-authenticate-totp-button-verify", By.ID), + "ocp_page": "Overview ยท Red Hat OpenShift Container Platform", + "username": ("username", By.ID), + "password": ("password", By.ID), + "click_login": ("signinbutton", By.ID), +} +if ibm_cloud_managed: + login.update(login_ibm_cloud) + azure_managed = "" if ( config.ENV_DATA["platform"] == constants.AZURE_PLATFORM diff --git a/setup.py b/setup.py index d96488e2788..482ab1363d8 100644 --- a/setup.py +++ b/setup.py @@ -100,6 +100,7 @@ "psycopg2-binary==2.9.9", "azure-keyvault-secrets==4.8.0", "pytest-jira==0.3.21", + "pyotp==2.9.0", ], entry_points={ "console_scripts": [ From 1714382a762d6788b429ec2fbfc3fce6c1e98899 Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Sun, 8 Dec 2024 00:22:03 +0100 Subject: [PATCH 08/16] Change ACM Page title for IBM Cloud ROKS Signed-off-by: Petr Balogh --- ocs_ci/ocs/acm/acm.py | 12 ++++++++++-- ocs_ci/ocs/acm/acm_constants.py | 1 + ocs_ci/ocs/ui/views.py | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ocs_ci/ocs/acm/acm.py b/ocs_ci/ocs/acm/acm.py index 9eecd375970..080a42028be 100644 --- a/ocs_ci/ocs/acm/acm.py +++ b/ocs_ci/ocs/acm/acm.py @@ -19,6 +19,7 @@ ACM_PAGE_TITLE, ACM_2_7_MULTICLUSTER_URL, ACM_PAGE_TITLE_2_7_ABOVE, + ACM_PAGE_TITLE_2_7_ABOVE_IBM_CLOUD_MANAGED, ) from ocs_ci.ocs.ocp import OCP, get_ocp_url from ocs_ci.framework import config @@ -450,11 +451,18 @@ def login_to_acm(): page_nav = AcmPageNavigator() if not compare_versions(cmp_str): page_nav.navigate_from_ocp_to_acm_cluster_page() - + ibm_cloud_managed = ( + config.ENV_DATA["platform"] == constants.IBMCLOUD_PLATFORM + and config.ENV_DATA["deployment_type"] == "managed" + ) if compare_versions(cmp_str): - page_title = ACM_PAGE_TITLE_2_7_ABOVE + if ibm_cloud_managed: + page_title = ACM_PAGE_TITLE_2_7_ABOVE_IBM_CLOUD_MANAGED + else: + page_title = ACM_PAGE_TITLE_2_7_ABOVE else: page_title = ACM_PAGE_TITLE + log.info(f"Validating page title to be: {page_title}") validate_page_title(title=page_title) return driver diff --git a/ocs_ci/ocs/acm/acm_constants.py b/ocs_ci/ocs/acm/acm_constants.py index 58e70ca5344..d90f7f7a80b 100644 --- a/ocs_ci/ocs/acm/acm_constants.py +++ b/ocs_ci/ocs/acm/acm_constants.py @@ -7,4 +7,5 @@ # Misc. ACM_PAGE_TITLE = "Red Hat Advanced Cluster Management for Kubernetes" ACM_PAGE_TITLE_2_7_ABOVE = "Red Hat OpenShift" +ACM_PAGE_TITLE_2_7_ABOVE_IBM_CLOUD_MANAGED = "Red Hat OpenShift Container Platform" ACM_2_7_MULTICLUSTER_URL = "/multicloud/infrastructure/clusters/managed" diff --git a/ocs_ci/ocs/ui/views.py b/ocs_ci/ocs/ui/views.py index 3aa4ad11f3f..9e1ace64e0f 100644 --- a/ocs_ci/ocs/ui/views.py +++ b/ocs_ci/ocs/ui/views.py @@ -774,6 +774,8 @@ "modal_dialog_close_button": ("//button[@aria-label='Close']", By.XPATH), "Policies": ("a[data-test-id='horizontal-link-Policies']", By.CSS_SELECTOR), } +if ibm_cloud_managed: + acm_page_nav["Clusters_page"] = ("Cluster list", By.LINK_TEXT) acm_configuration = { "cluster-sets": ("//a[normalize-space()='Cluster sets']", By.XPATH), From bbe1f243a482bc779b4f65ce89f898dbbb387e0d Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Mon, 9 Dec 2024 11:45:29 +0100 Subject: [PATCH 09/16] Change ACM version to 2.12 for IBM ROKS Signed-off-by: Petr Balogh --- ocs_ci/framework/conf/ocp_version/ocp-4.16-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ocs_ci/framework/conf/ocp_version/ocp-4.16-config.yaml b/ocs_ci/framework/conf/ocp_version/ocp-4.16-config.yaml index a950d3ee4c7..fd3c5e590eb 100644 --- a/ocs_ci/framework/conf/ocp_version/ocp-4.16-config.yaml +++ b/ocs_ci/framework/conf/ocp_version/ocp-4.16-config.yaml @@ -11,6 +11,6 @@ DEPLOYMENT: ENV_DATA: # TODO: replace with 4.16 once template is available vm_template: "rhcos-416.94.202403071059-0-vmware.x86_64" - acm_hub_channel: release-2.11 - acm_version: "2.11" + acm_hub_channel: release-2.12 + acm_version: "2.12" submariner_version: "0.18.0" From 7ba96617e69572fbed5c07b70071e4fab5c7527c Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Mon, 9 Dec 2024 14:19:24 +0100 Subject: [PATCH 10/16] Increase sumbmariner gateway change for IBM Cloud ROKS And not disable NAT-T for ROKS cluster Signed-off-by: Petr Balogh --- ocs_ci/ocs/acm/acm.py | 49 ++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/ocs_ci/ocs/acm/acm.py b/ocs_ci/ocs/acm/acm.py index 080a42028be..a7d1b56cefc 100644 --- a/ocs_ci/ocs/acm/acm.py +++ b/ocs_ci/ocs/acm/acm.py @@ -265,28 +265,35 @@ def install_submariner_ui(self, globalnet=True): ) log.info("Click on Next button") self.do_click(self.page_nav["next-btn"]) - log.info("Click on 'Enable NAT-T' to uncheck it") - self.do_click(self.page_nav["nat-t-checkbox"]) - log.info( - "Increase the gateway count to 3 by clicking twice on the gateway count add button" + acm_version = ".".join(get_running_acm_version().split(".")[:2]) + increase_gateway = False + if compare_versions(f"{acm_version}>=2.12"): + increase_gateway = True + ibm_cloud_managed = ( + config.ENV_DATA["platform"] == constants.IBMCLOUD_PLATFORM + and config.ENV_DATA["deployment_type"] == "managed" ) - self.do_click(self.page_nav["gateway-count-btn"]) - self.do_click(self.page_nav["gateway-count-btn"]) - if config.ENV_DATA.get("submariner_release_type") == "unreleased": - self.submariner_unreleased_downstream_info() - log.info("Click on Next button") - self.do_click(self.page_nav["next-btn"]) - log.info("Click on 'Enable NAT-T' to uncheck it [2]") - self.do_click(self.page_nav["nat-t-checkbox"]) - log.info( - "Increase the gateway count to 3 by clicking twice on the gateway count add button [2]" - ) - self.do_click(self.page_nav["gateway-count-btn"]) - self.do_click(self.page_nav["gateway-count-btn"]) - if config.ENV_DATA.get("submariner_release_type") == "unreleased": - self.submariner_unreleased_downstream_info() - log.info("Click on Next button [2]") - self.do_click(self.page_nav["next-btn"]) + increase_gateway_number = 2 + if ibm_cloud_managed: + increase_gateway_number = 1 + for cluster_nr in range(1, 3): + if not ibm_cloud_managed: + log.info( + f"Click on 'Enable NAT-T' to uncheck it for cluster [{cluster_nr}]" + ) + self.do_click(self.page_nav["nat-t-checkbox"]) + if increase_gateway: + log.info( + f"Increase the gateway count by {increase_gateway_number} clicking" + f" gateway count add button for cluster [{cluster_nr}]" + ) + for _ in range(increase_gateway_number): + self.do_click(self.page_nav["gateway-count-btn"]) + if config.ENV_DATA.get("submariner_release_type") == "unreleased": + self.submariner_unreleased_downstream_info() + self.take_screenshot() + log.info("Click on Next button for cluster [{cluster_nr}]") + self.do_click(self.page_nav["next-btn"]) if ocs_version >= version.VERSION_4_13 and globalnet: check_globalnet = self.get_element_text(self.page_nav["check-globalnet"]) assert ( From 651ea4d5f5133b9e739c1ae569a392cfd6d97241 Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Mon, 9 Dec 2024 14:47:55 +0100 Subject: [PATCH 11/16] Increase timout for validation Submariner for IBM Cloud ROKS Signed-off-by: Petr Balogh --- ocs_ci/ocs/acm/acm.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/ocs_ci/ocs/acm/acm.py b/ocs_ci/ocs/acm/acm.py index a7d1b56cefc..e67784c7a0f 100644 --- a/ocs_ci/ocs/acm/acm.py +++ b/ocs_ci/ocs/acm/acm.py @@ -327,7 +327,13 @@ def submariner_validation_ui(self): This is a mandatory pre-check for Regional DR. """ - + timeout = 600 + ibm_cloud_managed = ( + config.ENV_DATA["platform"] == constants.IBMCLOUD_PLATFORM + and config.ENV_DATA["deployment_type"] == "managed" + ) + if ibm_cloud_managed: + timeout = 2100 self.navigate_clusters_page() cluster_sets_page = self.wait_until_expected_text_is_found( locator=self.page_nav["cluster-sets"], @@ -350,34 +356,34 @@ def submariner_validation_ui(self): assert self.wait_until_expected_text_is_found( locator=self.page_nav["connection-status-1"], expected_text="Healthy", - timeout=600, + timeout=timeout, ), "Connection status 1 is unhealthy for Submariner" assert self.wait_until_expected_text_is_found( locator=self.page_nav["connection-status-2"], expected_text="Healthy", - timeout=600, + timeout=timeout, ), "Connection status 2 is unhealthy for Submariner" log.info("Checking agent status of both the imported clusters") assert self.wait_until_expected_text_is_found( locator=self.page_nav["agent-status-1"], expected_text="Healthy", - timeout=600, + timeout=timeout, ), "Agent status 1 is unhealthy for Submariner" assert self.wait_until_expected_text_is_found( locator=self.page_nav["agent-status-2"], expected_text="Healthy", - timeout=600, + timeout=timeout, ), "Agent status 2 is unhealthy for Submariner" log.info("Checking if nodes of both the imported clusters are labeled or not") assert self.wait_until_expected_text_is_found( locator=self.page_nav["node-label-1"], expected_text="Nodes labeled", - timeout=600, + timeout=timeout, ), "First gateway node label check did not pass for Submariner" assert self.wait_until_expected_text_is_found( locator=self.page_nav["node-label-2"], expected_text="Nodes labeled", - timeout=600, + timeout=timeout, ), "Second gateway node label check did not pass for Submariner" self.take_screenshot() log.info("Submariner is healthy, check passed") From dd353b8cb14b1fd109efae931e27519d5215be33 Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Fri, 13 Dec 2024 14:03:36 +0100 Subject: [PATCH 12/16] add new regions config files for ibm cloud Signed-off-by: Petr Balogh --- .../ibm_cloud_vpc_cluster_zone_jp_tok_1.yaml | 29 +++++++++++++++++++ .../ibm_cloud_vpc_cluster_zone_jp_tok_2.yaml | 29 +++++++++++++++++++ .../ibm_cloud_vpc_cluster_zone_jp_tok_3.yaml | 29 +++++++++++++++++++ .../ibm_cloud_vpc_cluster_zone_us_east_1.yaml | 29 +++++++++++++++++++ .../ibm_cloud_vpc_cluster_zone_us_east_2.yaml | 29 +++++++++++++++++++ .../ibm_cloud_vpc_cluster_zone_us_east_3.yaml | 29 +++++++++++++++++++ 6 files changed, 174 insertions(+) create mode 100644 conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_jp_tok_1.yaml create mode 100644 conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_jp_tok_2.yaml create mode 100644 conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_jp_tok_3.yaml create mode 100644 conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_us_east_1.yaml create mode 100644 conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_us_east_2.yaml create mode 100644 conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_us_east_3.yaml diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_jp_tok_1.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_jp_tok_1.yaml new file mode 100644 index 00000000000..b947fb0e42f --- /dev/null +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_jp_tok_1.yaml @@ -0,0 +1,29 @@ + +# This is the basic config for IBM cloud usage +--- +ENV_DATA: + platform: 'ibm_cloud' + deployment_type: 'managed' + region: 'jp-tok' + worker_availability_zone: 'jp-tok-1' + provider: "vpc-gen2" + worker_instance_type: "bx2.16x64" + master_replicas: 0 + worker_replicas: 3 + worker_availability_zones: + - 'jp-tok-1' + rhel_workers: true + # Following values needs to be set in separate config and passed to ocs-ci in + # order to deploy OCP/OCS cluster on IBM Cloud + # vpc_id: VPC ID PLACEHOLDER + # subnet_id: SUBNET ID PLACEHOLDER + # cos_instance: COS INSTANCE PLACEHOLDER +#AUTH: +# ibmcloud: +# api_key: IBM CLOUD API KEY PLACEHOLDER +# account_id: ACCOUNT ID PLACEHOLDER +# ibm_cos_access_key_id: KEY PLACEHOLDER +# ibm_cos_secret_access_key: SECRET PLACEHOLDER +DEPLOYMENT: + cnv_latest_stable: true + # ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_jp_tok_2.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_jp_tok_2.yaml new file mode 100644 index 00000000000..9a4a059d10d --- /dev/null +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_jp_tok_2.yaml @@ -0,0 +1,29 @@ + +# This is the basic config for IBM cloud usage +--- +ENV_DATA: + platform: 'ibm_cloud' + deployment_type: 'managed' + region: 'jp-tok' + worker_availability_zone: 'jp-tok-2' + provider: "vpc-gen2" + worker_instance_type: "bx2.16x64" + master_replicas: 0 + worker_replicas: 3 + worker_availability_zones: + - 'jp-tok-2' + rhel_workers: true + # Following values needs to be set in separate config and passed to ocs-ci in + # order to deploy OCP/OCS cluster on IBM Cloud + # vpc_id: VPC ID PLACEHOLDER + # subnet_id: SUBNET ID PLACEHOLDER + # cos_instance: COS INSTANCE PLACEHOLDER +#AUTH: +# ibmcloud: +# api_key: IBM CLOUD API KEY PLACEHOLDER +# account_id: ACCOUNT ID PLACEHOLDER +# ibm_cos_access_key_id: KEY PLACEHOLDER +# ibm_cos_secret_access_key: SECRET PLACEHOLDER +DEPLOYMENT: + cnv_latest_stable: true + # ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_jp_tok_3.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_jp_tok_3.yaml new file mode 100644 index 00000000000..1834580093b --- /dev/null +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_jp_tok_3.yaml @@ -0,0 +1,29 @@ + +# This is the basic config for IBM cloud usage +--- +ENV_DATA: + platform: 'ibm_cloud' + deployment_type: 'managed' + region: 'jp-tok' + worker_availability_zone: 'jp-tok-3' + provider: "vpc-gen2" + worker_instance_type: "bx2.16x64" + master_replicas: 0 + worker_replicas: 3 + worker_availability_zones: + - 'jp-tok-3' + rhel_workers: true + # Following values needs to be set in separate config and passed to ocs-ci in + # order to deploy OCP/OCS cluster on IBM Cloud + # vpc_id: VPC ID PLACEHOLDER + # subnet_id: SUBNET ID PLACEHOLDER + # cos_instance: COS INSTANCE PLACEHOLDER +#AUTH: +# ibmcloud: +# api_key: IBM CLOUD API KEY PLACEHOLDER +# account_id: ACCOUNT ID PLACEHOLDER +# ibm_cos_access_key_id: KEY PLACEHOLDER +# ibm_cos_secret_access_key: SECRET PLACEHOLDER +DEPLOYMENT: + cnv_latest_stable: true + # ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_us_east_1.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_us_east_1.yaml new file mode 100644 index 00000000000..8de25a26fe1 --- /dev/null +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_us_east_1.yaml @@ -0,0 +1,29 @@ + +# This is the basic config for IBM cloud usage +--- +ENV_DATA: + platform: 'ibm_cloud' + deployment_type: 'managed' + region: 'us-east' + worker_availability_zone: 'us-east-1' + provider: "vpc-gen2" + worker_instance_type: "bx2.16x64" + master_replicas: 0 + worker_replicas: 3 + worker_availability_zones: + - 'us-east-1' + rhel_workers: true + # Following values needs to be set in separate config and passed to ocs-ci in + # order to deploy OCP/OCS cluster on IBM Cloud + # vpc_id: VPC ID PLACEHOLDER + # subnet_id: SUBNET ID PLACEHOLDER + # cos_instance: COS INSTANCE PLACEHOLDER +#AUTH: +# ibmcloud: +# api_key: IBM CLOUD API KEY PLACEHOLDER +# account_id: ACCOUNT ID PLACEHOLDER +# ibm_cos_access_key_id: KEY PLACEHOLDER +# ibm_cos_secret_access_key: SECRET PLACEHOLDER +DEPLOYMENT: + cnv_latest_stable: true + # ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_us_east_2.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_us_east_2.yaml new file mode 100644 index 00000000000..9e1495ab0c3 --- /dev/null +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_us_east_2.yaml @@ -0,0 +1,29 @@ + +# This is the basic config for IBM cloud usage +--- +ENV_DATA: + platform: 'ibm_cloud' + deployment_type: 'managed' + region: 'us-east' + worker_availability_zone: 'us-east-2' + provider: "vpc-gen2" + worker_instance_type: "bx2.16x64" + master_replicas: 0 + worker_replicas: 3 + worker_availability_zones: + - 'us-east-2' + rhel_workers: true + # Following values needs to be set in separate config and passed to ocs-ci in + # order to deploy OCP/OCS cluster on IBM Cloud + # vpc_id: VPC ID PLACEHOLDER + # subnet_id: SUBNET ID PLACEHOLDER + # cos_instance: COS INSTANCE PLACEHOLDER +#AUTH: +# ibmcloud: +# api_key: IBM CLOUD API KEY PLACEHOLDER +# account_id: ACCOUNT ID PLACEHOLDER +# ibm_cos_access_key_id: KEY PLACEHOLDER +# ibm_cos_secret_access_key: SECRET PLACEHOLDER +DEPLOYMENT: + cnv_latest_stable: true + # ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER diff --git a/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_us_east_3.yaml b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_us_east_3.yaml new file mode 100644 index 00000000000..ef3bc18ba40 --- /dev/null +++ b/conf/deployment/ibmcloud/ibm_cloud_vpc_cluster_zone_us_east_3.yaml @@ -0,0 +1,29 @@ + +# This is the basic config for IBM cloud usage +--- +ENV_DATA: + platform: 'ibm_cloud' + deployment_type: 'managed' + region: 'us-east' + worker_availability_zone: 'us-east-3' + provider: "vpc-gen2" + worker_instance_type: "bx2.16x64" + master_replicas: 0 + worker_replicas: 3 + worker_availability_zones: + - 'us-east-3' + rhel_workers: true + # Following values needs to be set in separate config and passed to ocs-ci in + # order to deploy OCP/OCS cluster on IBM Cloud + # vpc_id: VPC ID PLACEHOLDER + # subnet_id: SUBNET ID PLACEHOLDER + # cos_instance: COS INSTANCE PLACEHOLDER +#AUTH: +# ibmcloud: +# api_key: IBM CLOUD API KEY PLACEHOLDER +# account_id: ACCOUNT ID PLACEHOLDER +# ibm_cos_access_key_id: KEY PLACEHOLDER +# ibm_cos_secret_access_key: SECRET PLACEHOLDER +DEPLOYMENT: + cnv_latest_stable: true + # ocs_secret_dockerconfigjson: BASE64 OF QUAY SECRET PLACEHOLDER From efcb634cbf978bddbfbc79f267f1a9557840216e Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Fri, 13 Dec 2024 17:59:39 +0100 Subject: [PATCH 13/16] Add retry for CNV subscription Signed-off-by: Petr Balogh --- ocs_ci/deployment/cnv.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ocs_ci/deployment/cnv.py b/ocs_ci/deployment/cnv.py index 6bedc31330d..a935513e93c 100644 --- a/ocs_ci/deployment/cnv.py +++ b/ocs_ci/deployment/cnv.py @@ -138,7 +138,9 @@ def create_cnv_subscription(self): cnv_subscription_yaml_data, cnv_subscription_manifest.name ) logger.info("Creating subscription for CNV operator") - run_cmd(f"oc create -f {cnv_subscription_manifest.name}") + retry(exceptions.CommandFailed, tries=15, delay=60, backoff=1)(run_cmd)( + f"oc apply -f {cnv_subscription_manifest.name}" + ) self.wait_for_the_resource_to_discover( kind=constants.SUBSCRIPTION_WITH_ACM, namespace=self.namespace, From b3336ffd6a0ac93b65823cb9325a3b49b45c62a4 Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Tue, 17 Dec 2024 10:28:07 +0100 Subject: [PATCH 14/16] Enable disaster recovery for IBM Cloud ROKS ODF add-on Signed-off-by: Petr Balogh --- ocs_ci/deployment/deployment.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ocs_ci/deployment/deployment.py b/ocs_ci/deployment/deployment.py index ad51d474f49..5deb45836c7 100644 --- a/ocs_ci/deployment/deployment.py +++ b/ocs_ci/deployment/deployment.py @@ -1653,6 +1653,9 @@ def deploy_odf_addon(self): ocs_version = version.get_semantic_ocs_version_from_config() disable_noobaa = config.COMPONENTS.get("disable_noobaa", False) noobaa_cmd_arg = f"--param ignoreNoobaa={str(disable_noobaa).lower()}" + dr_cmd_arg = "" + if config.MULTICLUSTER.get("multicluster_mode") == constants.RDR_MODE: + dr_cmd_arg = "--param prepareForDisasterRecovery=true" device_size = int( config.ENV_DATA.get("device_size", defaults.DEVICE_SIZE_IBM_CLOUD_MANAGED) ) @@ -1665,7 +1668,7 @@ def deploy_odf_addon(self): osd_size_arg = f"--param osdSize={device_size}Gi" cmd = ( f"ibmcloud ks cluster addon enable openshift-data-foundation --cluster {clustername} -f --version " - f"{ocs_version}.0 {noobaa_cmd_arg} {osd_size_arg}" + f"{ocs_version}.0 {noobaa_cmd_arg} {osd_size_arg} {dr_cmd_arg}" ) run_ibmcloud_cmd(cmd) time.sleep(120) From 80a4ee714f60a4c2d8e5d2a75904783f53f0419d Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Mon, 6 Jan 2025 16:39:27 +0100 Subject: [PATCH 15/16] Increase timeout for RDR scenario for node restart to 900 sec Signed-off-by: Petr Balogh --- ocs_ci/utility/ibmcloud.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/ocs_ci/utility/ibmcloud.py b/ocs_ci/utility/ibmcloud.py index 522e228f544..db5ae506a82 100644 --- a/ocs_ci/utility/ibmcloud.py +++ b/ocs_ci/utility/ibmcloud.py @@ -358,10 +358,20 @@ def start_nodes(self, nodes, wait=True): self.restart_nodes(nodes) if wait: + timeout = 300 + ibm_cloud_managed = ( + config.ENV_DATA["platform"] == constants.IBMCLOUD_PLATFORM + and config.ENV_DATA["deployment_type"] == "managed" + ) + if ibm_cloud_managed: + timeout = 900 # When the node is reachable then the node reaches status Ready. logger.info(f"Waiting for nodes: {node_names} to reach ready state") wait_for_nodes_status( - node_names=node_names, status=constants.NODE_READY, timeout=180, sleep=5 + node_names=node_names, + status=constants.NODE_READY, + timeout=timeout, + sleep=5, ) def stop_nodes(self, nodes, wait=True): @@ -385,10 +395,17 @@ def stop_nodes(self, nodes, wait=True): run_cmd(cmd.format(node)) if wait: + timeout = 300 + ibm_cloud_managed = ( + config.ENV_DATA["platform"] == constants.IBMCLOUD_PLATFORM + and config.ENV_DATA["deployment_type"] == "managed" + ) + if ibm_cloud_managed: + timeout = 900 # When the node is reachable then the node reaches status Ready. logger.info(f"Waiting for nodes: {node_names} to reach not ready state") wait_for_nodes_status( - node_names, constants.NODE_NOT_READY, timeout=180, sleep=5 + node_names, constants.NODE_NOT_READY, timeout=timeout, sleep=5 ) def restart_nodes(self, nodes, timeout=900, wait=True): From 5e85a2a4aa3f16d9f236aff21b2bfc0c319c92c6 Mon Sep 17 00:00:00 2001 From: Petr Balogh Date: Tue, 7 Jan 2025 13:28:03 +0100 Subject: [PATCH 16/16] Change DR Policy for IBM Cloud Managed platform to odf3-odf4-10m Signed-off-by: Petr Balogh --- ocs_ci/deployment/deployment.py | 9 +++++++++ ocs_ci/ocs/constants.py | 1 + 2 files changed, 10 insertions(+) diff --git a/ocs_ci/deployment/deployment.py b/ocs_ci/deployment/deployment.py index 5deb45836c7..1fc7dc3766f 100644 --- a/ocs_ci/deployment/deployment.py +++ b/ocs_ci/deployment/deployment.py @@ -3022,6 +3022,15 @@ def deploy_dr_policy(self): dr_policy_hub_data["spec"]["drClusters"][index] = cluster.ENV_DATA[ "cluster_name" ] + ibm_cloud_managed = ( + config.ENV_DATA["platform"] == constants.IBMCLOUD_PLATFORM + and config.ENV_DATA["deployment_type"] == "managed" + ) + if ibm_cloud_managed: + dr_policy_hub_data["metadata"][ + "name" + ] = constants.RDR_DR_POLICY_IBM_CLOUD_MANAGED + dr_policy_hub_data["spec"]["schedulingInterval"] = "10m" if config.MULTICLUSTER["multicluster_mode"] == "metro-dr": dr_policy_hub_data["metadata"]["name"] = constants.MDR_DR_POLICY diff --git a/ocs_ci/ocs/constants.py b/ocs_ci/ocs/constants.py index b448d6ea020..6cdbee74168 100644 --- a/ocs_ci/ocs/constants.py +++ b/ocs_ci/ocs/constants.py @@ -1110,6 +1110,7 @@ RDR_MODE = "regional-dr" MDR_MODE = "metro-dr" MDR_DR_POLICY = "odr-policy-mdr" +RDR_DR_POLICY_IBM_CLOUD_MANAGED = "odf3-odf4-10m" RESTIC_OR_NODE_AGENT_POD_COUNT = 3 VELERO_POD_COUNT = 1 MDR_DPA = "dpa-1"