Skip to content

Commit

Permalink
Merge branch 'master' into multi-cnv-workload
Browse files Browse the repository at this point in the history
  • Loading branch information
avd-sagare authored Dec 13, 2024
2 parents 6676e51 + d29c56c commit 8ff8e3d
Show file tree
Hide file tree
Showing 122 changed files with 2,026 additions and 2,494 deletions.
80 changes: 0 additions & 80 deletions -

This file was deleted.

3 changes: 3 additions & 0 deletions conf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ higher priority).
* `continue_upgrade_after_checks_even_if_not_healthy` - if set to true Rook will continue the OSD daemon upgrade process even if the PGs are not clean.
* `upgrade_osd_requires_healthy_pgs` - If set to true OSD upgrade process won't start until PGs are healthy.
* `workaround_mark_disks_as_ssd` - WORKAROUND: mark disks as SSD (not rotational - `0` in `/sys/block/*d*/queue/rotational`)
* `node_labels` - Comma-separated labels to be applied to the nodes in the cluster, e.g. 'cluster.ocs.openshift.io/openshift-storage="",node-role.kubernetes.io/infra=""', default - empty string

#### UPGRADE

Expand Down Expand Up @@ -416,6 +417,8 @@ Configuration specific to external Ceph cluster
* `external_cluster_details` - base64 encoded data of json output from exporter script
* `rgw_secure` - boolean parameter which defines if external Ceph cluster RGW is secured using SSL
* `rgw_cert_ca` - url pointing to CA certificate used to sign certificate for RGW with SSL
* `use_rbd_namespace` - boolean parameter to use RBD namespace in pool
* `rbd_namespace` - Name of RBD namespace to use in pool

##### login

Expand Down
1 change: 1 addition & 0 deletions conf/deployment/aws/rosa_hcp_1az_3w_m5.12x.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ ENV_DATA:
ms_env_type: "staging"
addon_name: "ocs-converged"
persistent-monitoring: false
node_labels: cluster.ocs.openshift.io/openshift-storage=""
1 change: 1 addition & 0 deletions conf/deployment/aws/rosa_hcp_1az_6w_m5.2x.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ ENV_DATA:
ms_env_type: "staging"
addon_name: "ocs-converged"
persistent-monitoring: false
node_labels: cluster.ocs.openshift.io/openshift-storage=""
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
# This config is suppose to work on most of DCs we have.
DEPLOYMENT:
allow_lower_instance_requirements: false
ENV_DATA:
platform: 'vsphere'
deployment_type: 'ipi'
worker_replicas: 6
master_replicas: 3
master_num_cpus: '16'
master_memory: '65536'
fio_storageutilization_min_mbps: 10.0
in_transit_encryption: true
REPORTING:
polarion:
deployment_id: 'OCS-4690'
4 changes: 4 additions & 0 deletions conf/ocsci/external_rhcs_with_rbd_namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Config file to use RBD namespace in a pool
---
EXTERNAL_MODE:
use_rbd_namespace: True
3 changes: 2 additions & 1 deletion ocs_ci/deployment/acm.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def __init__(self):
self.dr_only_list = []

def deploy(self):
# Download subctl binary in any case.
self.download_binary()
if self.source == "upstream":
self.deploy_upstream()
elif self.source == "downstream":
Expand All @@ -94,7 +96,6 @@ def deploy(self):
raise Exception(f"The Submariner source: {self.source} is not recognized")

def deploy_upstream(self):
self.download_binary()
self.submariner_configure_upstream()

def deploy_downstream(self):
Expand Down
38 changes: 35 additions & 3 deletions ocs_ci/deployment/helpers/external_cluster_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@
import logging
import re
import tempfile
import uuid

from ocs_ci.framework import config
from ocs_ci.ocs import defaults, constants
from ocs_ci.ocs.ocp import OCP
from ocs_ci.ocs.exceptions import (
ExternalClusterCephfsMissing,
ExternalClusterCephSSHAuthDetailsMissing,
ExternalClusterExporterRunFailed,
ExternalClusterRBDNamespaceCreationFailed,
ExternalClusterRGWEndPointMissing,
ExternalClusterRGWEndPointPortMissing,
ExternalClusterCephSSHAuthDetailsMissing,
ExternalClusterObjectStoreUserCreationFailed,
ExternalClusterCephfsMissing,
ExternalClusterNodeRoleNotFound,
ExternalClusterObjectStoreUserCreationFailed,
)
from ocs_ci.ocs.resources import pod
from ocs_ci.ocs.resources.csv import get_csv_name_start_with_prefix
Expand Down Expand Up @@ -133,6 +135,12 @@ def get_external_cluster_details(self):
ceph_user = config.EXTERNAL_MODE["run_as_user"]
params = f"{params} --run-as-user {ceph_user}"

if config.EXTERNAL_MODE.get("use_rbd_namespace"):
rbd_namespace = config.EXTERNAL_MODE.get(
"rbd_namespace"
) or self.create_rbd_namespace(rbd=rbd_name)
params = f"{params} --rados-namespace {rbd_namespace}"

out = self.run_exporter_script(params=params)

# encode the exporter script output to base64
Expand Down Expand Up @@ -476,6 +484,30 @@ def is_rgw_user_exists(self, user):
logger.debug(f"RGW users: {rgw_user_list}")
return True if user in rgw_user_list else False

def create_rbd_namespace(self, rbd, namespace=None):
"""
Create RBD namespace
Args:
rbd (str): RBD pool name where namespace has to create
namespace (str): Name of RBD namespace
Returns:
str: RBD Namepsace name
Raises:
ExternalClusterRBDNamespaceCreationFailed: In case fails to create RBD namespace
"""
namespace = namespace or f"rbd_namespace_{uuid.uuid4().hex[:8]}"
logger.info(f"creating RBD namespace {namespace}")
cmd = f"rbd namespace create {rbd}/{namespace}"
retcode, out, err = self.rhcs_conn.exec_cmd(cmd)
if retcode != 0:
logger.error(f"Failed to create RBD namespace in {rbd}. Error: {err}")
raise ExternalClusterRBDNamespaceCreationFailed
return namespace


def get_exporter_script_from_configmap():
"""
Expand Down
3 changes: 3 additions & 0 deletions ocs_ci/deployment/helpers/odf_deployment_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ def get_required_csvs():
if ocs_version >= version.VERSION_4_17:
operators_4_17_additions = [defaults.CEPHCSI_OPERATOR]
ocs_operator_names.extend(operators_4_17_additions)
if ocs_version >= version.VERSION_4_18:
operators_4_18_additions = [defaults.ODF_DEPENDENCIES]
ocs_operator_names.extend(operators_4_18_additions)
return ocs_operator_names
11 changes: 7 additions & 4 deletions ocs_ci/deployment/hosted_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ def deploy_ocp(
if not config.ENV_DATA["platform"].lower() in HCI_PROVIDER_CLIENT_PLATFORMS:
raise ProviderModeNotFoundException()

if not config.ENV_DATA.get("deploy_acm_hub_cluster", True):
deploy_acm_hub = False

self.deploy_dependencies(
deploy_acm_hub, deploy_cnv, deploy_metallb, download_hcp_binary
)
Expand Down Expand Up @@ -917,7 +920,7 @@ def get_onboarding_key(self):
str: onboarding token key
"""
secret_ocp_obj = ocp.OCP(
kind=constants.SECRET, namespace=constants.OPENSHIFT_STORAGE_NAMESPACE
kind=constants.SECRET, namespace=config.ENV_DATA["cluster_namespace"]
)

key = (
Expand Down Expand Up @@ -1160,7 +1163,7 @@ def get_provider_address(self):
"""
Get the provider address
"""
ocp = OCP(namespace=constants.OPENSHIFT_STORAGE_NAMESPACE)
ocp = OCP(namespace=config.ENV_DATA["cluster_namespace"])
storage_provider_endpoint = ocp.exec_oc_cmd(
(
"get storageclusters.ocs.openshift.io -o jsonpath={'.items[*].status.storageProviderEndpoint'}"
Expand Down Expand Up @@ -1210,7 +1213,7 @@ def storage_claim_exists_cephfs(self):
else:
ocp = OCP(
kind=constants.STORAGECLAIM,
namespace=constants.OPENSHIFT_STORAGE_NAMESPACE,
namespace=config.ENV_DATA["cluster_namespace"],
cluster_kubeconfig=self.cluster_kubeconfig,
)

Expand Down Expand Up @@ -1297,7 +1300,7 @@ def storage_claim_exists_rbd(self):
else:
ocp = OCP(
kind=constants.STORAGECLAIM,
namespace=constants.OPENSHIFT_STORAGE_NAMESPACE,
namespace=config.ENV_DATA["cluster_namespace"],
cluster_kubeconfig=self.cluster_kubeconfig,
)

Expand Down
21 changes: 21 additions & 0 deletions ocs_ci/deployment/ibmcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
LeftoversExistError,
VolumesExistError,
)
from ocs_ci.ocs.resources.backingstore import get_backingstore
from ocs_ci.ocs.resources.pvc import (
scale_down_pods_and_remove_pvcs,
)
Expand Down Expand Up @@ -203,6 +204,7 @@ def destroy_cluster(self, log_level="DEBUG"):
resource_group = self.get_resource_group()
if resource_group:
try:
self.delete_bucket()
scale_down_pods_and_remove_pvcs(self.DEFAULT_STORAGECLASS)
except Exception as err:
logger.warning(
Expand Down Expand Up @@ -235,6 +237,25 @@ def destroy_cluster(self, log_level="DEBUG"):
logger.info("Force cleaning up Service IDs and Account Policies leftovers")
ibmcloud.cleanup_policies_and_service_ids(self.cluster_name)

def delete_bucket(self):
"""
Deletes the COS bucket
"""
api_key = config.AUTH["ibmcloud"]["api_key"]
service_instance_id = config.AUTH["ibmcloud"]["cos_instance_crn"]
endpoint_url = constants.IBM_COS_GEO_ENDPOINT_TEMPLATE.format(
config.ENV_DATA.get("region", "us-east").lower()
)
backingstore = get_backingstore()
bucket_name = backingstore["spec"]["ibmCos"]["targetBucket"]
logger.debug(f"bucket name from backingstore: {bucket_name}")
cos = ibmcloud.IBMCloudObjectStorage(
api_key=api_key,
service_instance_id=service_instance_id,
endpoint_url=endpoint_url,
)
cos.delete_bucket(bucket_name=bucket_name)

def manually_create_iam_for_vpc(self):
"""
Manually specify the IAM secrets for the cloud provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def provider_and_native_client_installation(
if self.ocs_version >= version.VERSION_4_16:
# Validate native client is created in openshift-storage namespace
self.deployment.wait_for_csv(
self.ocs_client_operator, constants.OPENSHIFT_STORAGE_NAMESPACE
self.ocs_client_operator, config.ENV_DATA["cluster_namespace"]
)

# Verify native storageclient is created successfully
Expand Down
5 changes: 5 additions & 0 deletions ocs_ci/deployment/rosa.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ def deploy(self, log_level=""):
machinepool_details.wait_replicas_ready(
target_replicas=config.ENV_DATA["worker_replicas"], timeout=1200
)
if node_labels := config.ENV_DATA.get("node_labels"):
if machinepool_id := config.ENV_DATA.get("machine_pool"):
rosa.label_nodes(
self.cluster_name, machinepool_id, node_labels, rewrite=False
)

logger.info("generate kubeconfig and kubeadmin-password files")
if config.ENV_DATA["ms_env_type"] == "staging":
Expand Down
4 changes: 2 additions & 2 deletions ocs_ci/framework/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def __init__(self):
except ClusterNotFoundException:
# if no provider is available then set the switch to current index so that
# no switch happens and code runs on current cluster
logger.DEBUG("No provider was found - using current cluster")
logger.debug("No provider was found - using current cluster")
switch_index = config.cur_index
super().__init__(switch_index)

Expand All @@ -509,7 +509,7 @@ def __init__(self):
except ClusterNotFoundException:
# if no provider is available then set the switch to current index so that
# no switch happens and code runs on current cluster
logger.DEBUG("No Consumer was found - using current cluster")
logger.debug("No Consumer was found - using current cluster")
switch_index = config.cur_index
super().__init__(switch_index)

Expand Down
7 changes: 7 additions & 0 deletions ocs_ci/framework/conf/default_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ ENV_DATA:
#RDR Green field
rdr_osd_deployment_mode: "greenfield"

# Label nodes with specific labels, used for example fot ODF deployment on ROSA HCP
node_labels: ""

# Assisted Installer related settings

# This section is related to upgrade
Expand All @@ -288,6 +291,10 @@ UPGRADE:
ocp_upgrade_path: "quay.io/openshift-release-dev/ocp-release"
ocp_arch: "x86_64"
upgrade_logging_channel: "4.18"
# None value means that value in Rook operator config is used.
# Otherwise it is changed to the provided value before ODF upgrade.
csi_rbd_plugin_update_strategy_max_unavailable: null
csi_cephfs_plugin_update_strategy_max_unavailable: null

# This section stores secret and uploaded from home dir or s3
# for entry into this section, please email ecosystem team
Expand Down
5 changes: 5 additions & 0 deletions ocs_ci/framework/pytest_customization/marks.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,11 @@
reason="Azure KV config required to run the test.",
)

rosa_hcp_required = pytest.mark.skipif(
config.ENV_DATA["platform"].lower() != ROSA_HCP_PLATFORM,
reason="Test runs ONLY on ROSA HCP cluster",
)

external_mode_required = pytest.mark.skipif(
config.DEPLOYMENT.get("external_mode") is not True,
reason="Test will run on External Mode cluster only",
Expand Down
Loading

0 comments on commit 8ff8e3d

Please sign in to comment.