ocs_ci.deployment.helpers package
Submodules
ocs_ci.deployment.helpers.external_cluster_helpers module
This module contains helpers functions needed for external cluster deployment.
- class ocs_ci.deployment.helpers.external_cluster_helpers.ExternalCluster(host, user, password=None, ssh_key=None)
Bases:
objectHelper for External RHCS cluster
- create_object_store_user()
Create object store user on external cluster and update access_key and secret_key to config
- create_rbd_namespace(rbd, namespace=None)
Create RBD namespace
- Parameters:
rbd (str) – RBD pool name where namespace has to create
namespace (str) – Name of RBD namespace
- Returns:
RBD Namespace name
- Return type:
str
- Raises:
ExternalClusterRBDNamespaceCreationFailed – In case fails to create RBD namespace
- disable_certificate_check()
Disable certificate check
- Raises:
ExternalClusterDisableCertificateCheckFailed – In case fails to disable certificate check
- enable_secure_connection_mode()
Enables secure connection mode for RHCS cluster
- fetch_cephadm_root_ca_cert_pem()
Return the cephadm-managed root CA (
cephadm_root_ca_cert) from this host.Used for Ceph 19+ when RGW TLS is signed by the cephadm CA. Runs
cephadm shell; prefixessudowhen the SSH user is notroot.- Returns:
PEM text (with trailing newline).
- Return type:
str
- Raises:
ExternalClusterExporterRunFailed – If the remote command fails or PEM is empty.
- get_admin_keyring()
Fetches admin keyring from external RHCS cluster and updates to config.EXTERNAL_MODE
- get_ceph_fs()
Fetches the ceph filesystem name
- Returns:
ceph filesystem name
- Return type:
str
- Raises:
ExternalClusterCephfsMissing – in case of ceph filesystem doesn’t exist
- get_external_cluster_details()
Gets the external RHCS cluster details and updates to config.EXTERNAL_MODE
- Raises:
ExternalClusterExporterRunFailed – If exporter script failed to run on external RHCS cluster
- get_object_store_user_secrets(user)
Get the access and secret key for user
- Returns:
tuple which contains access_key and secret_key
- Return type:
tuple
- get_rgw_endpoint_api_port()
Fetches rgw endpoint api port.
For ceph 6.x, get port information from cephadm ls, for ceph 5.x, get port information from ceph config dump and for ceph 4.x, get port information from ceph.conf on rgw node
- Returns:
RGW endpoint port
- Return type:
str
- get_rhel_version()
Fetches the RHEL version on external RHCS cluster
- Returns:
RHEL version
- Return type:
str
- is_object_store_user_exists(user, realm=None)
Checks whether user exists in external cluster
- Parameters:
user (str) – Object store user name
realm (str) – Name of realm to check
- Returns:
True if user exists, otherwise false
- Return type:
bool
- is_rgw_user_exists(user)
Checks whether RGW user exists or not
- Parameters:
user (str) – RGW user name
- Returns:
True incase user exists, otherwise False
- Return type:
bool
- remove_rbd_images(images, pool)
Removes rbd images from external RHCS cluster
- Parameters:
images (list) – List of rbd images to delete
pool (str) – rbd pool name
- remove_rgw_user(user=None)
Remove RGW user if it exists
- Parameters:
user (str) – RGW user name
- run_exporter_script(params)
Runs the exporter script on RHCS cluster
- Parameters:
params (str) – Parameter to pass to exporter script
- Returns:
output of exporter script
- Return type:
str
- update_permission_caps(user=None)
Update permission caps on the external RHCS cluster
- upload_config_ini_file(params)
Upload config.ini file that is used for external cluster exporter script –config-file param
- Parameters:
params (str) – Parameter to pass to exporter script
- Returns:
absolute path to config.ini file
- Return type:
str
- upload_exporter_script()
Upload exporter script to RHCS cluster
- Returns:
absolute path to exporter script
- Return type:
str
- upload_rgw_cert_ca()
Upload RGW Cert CA to RHCS cluster
- Returns:
absolute path to the CA Cert
- Return type:
str
- ocs_ci.deployment.helpers.external_cluster_helpers.external_rgw_ca_should_use_cephadm_fetch()
True when external Ceph reports version >= 19.0 (cephadm certmgr path), or if version is not determined (None) - assuming that from ODF 4.18 we are using Ceph >= 19.
- ocs_ci.deployment.helpers.external_cluster_helpers.generate_exporter_script(use_configmap=False)
Generates exporter script for RHCS cluster
- Parameters:
use_configmap (bool) – If True, we will use the configmap to get the external exporter script. Otherwise, if False, we will get it from the CSV.
- Returns:
path to the exporter script
- Return type:
str
- ocs_ci.deployment.helpers.external_cluster_helpers.get_and_apply_rgw_cert_ca(apply=True)
Obtain the RGW TLS CA: for external Ceph 19.0+, fetch
cephadm_root_ca_certfrom the_adminnode via SSH; otherwise download fromrgw_cert_caURL.- Parameters:
apply (bool) – if True, the certificate is applied as trusted CA by the OCP cluster
- Returns:
path to the local RGW CA PEM file
- Return type:
str
- ocs_ci.deployment.helpers.external_cluster_helpers.get_exporter_script(use_configmap=False)
Get the external exporter script encoded
- Parameters:
use_configmap (bool) – If True, we will use the configmap to get the external exporter script. Otherwise, if False, we will get it from the CSV.
- Returns:
The external exporter script
- Return type:
str
- ocs_ci.deployment.helpers.external_cluster_helpers.get_exporter_script_from_configmap()
Get the external exporter script from the configmap. From 4.18 we can get the external exporter script from the configmap
- Returns:
The exporter script from the configmap
- Return type:
str
- ocs_ci.deployment.helpers.external_cluster_helpers.get_exporter_script_from_csv()
Get the external exporter script from the csv.
From ODF 4.19 the external mode script was removed from the CSV and is shipped only in the ConfigMap (rook-ceph-external-cluster-script-config). This function must not be used for ODF 4.19+; use get_exporter_script_from_configmap() or get_exporter_script(use_configmap=True) instead.
- Returns:
The exporter script from the csv
- Return type:
str
- Raises:
ValueError – If running ODF version is 4.19 or above (script is no longer in CSV).
- ocs_ci.deployment.helpers.external_cluster_helpers.get_external_cluster_client(role=None)
Resolve SSH target for an external RHCS node by role.
- Parameters:
role (str or None) – Node role to match in
external_cluster_node_roles(e.g.client,_admin). If None, uses_adminwhen multicluster elseclient.- Returns:
(ip_address, user, password, ssh_key)
- Return type:
tuple
- Raises:
ExternalClusterCephSSHAuthDetailsMissing – In case one of SSH key or password is not provided.
- ocs_ci.deployment.helpers.external_cluster_helpers.get_external_cluster_instance() ExternalCluster
Create and return an ExternalCluster instance using credentials from config.
- Returns:
Configured external cluster connection.
- Return type:
- Raises:
ExternalClusterCephSSHAuthDetailsMissing – If credentials missing.
- ocs_ci.deployment.helpers.external_cluster_helpers.get_node_by_role(nodes, role, user, password, ssh_key)
Get a node (a tuple with ip, user, password, ssh_key)
- Parameters:
nodes (list) – List of nodes participating
role (str) – Specific role of the nodes we are looking for
user (str) – Login user name for the node
password (str) – Login password for the node
ssh_key (str) – Path to ssh key
- Returns:
(ip_address, user, password, ssh_key)
- Return type:
Tuple
- Raises:
ExternalClusterNodeRoleNotFound (Exception) – if no node found with the desired role
- ocs_ci.deployment.helpers.external_cluster_helpers.get_rgw_endpoint()
Fetches rgw endpoint
- Returns:
rgw endpoint
- Return type:
str
- Raises:
ExternalClusterRGWEndPointMissing – in case of rgw endpoint missing
- ocs_ci.deployment.helpers.external_cluster_helpers.remove_csi_users()
Remove csi users from external RHCS cluster
- ocs_ci.deployment.helpers.external_cluster_helpers.try_embed_rgw_ca_pem_in_mcg_cli_resources(service_ca_data, sts_dict)
If deploy stashed
embedded_external_rgw_ca_pem, add it to the service-ca ConfigMap and add a matching volumeMount onsts_dict(first container).- Returns:
True if embedding was applied.
- Return type:
bool
ocs_ci.deployment.helpers.hypershift_base module
- class ocs_ci.deployment.helpers.hypershift_base.HyperShiftBase
Bases:
objectClass to handle HyperShift hosted cluster management
- apply_idms_to_hosted_cluster(name, idms_json_dict=None, replace=False)
Apply ImageDigestMirrorSet data to an existing HostedCluster as imageContentSources. This patches spec.imageContentSources of the HostedCluster resource in the management (hub) cluster.
- Parameters:
name (str) – HostedCluster name (namespace is clusters-<name> but resource lives in clusters namespace)
idms_json_dict (dict|None) – If provided, use this pre-fetched dict (output of ‘oc get imagedigestmirrorsets -o json’). If None, it will be fetched automatically.
replace (bool) – If True, replace any existing spec.imageContentSources with the new list. If False, merge (append new unique entries after existing ones).
- Returns:
True if patch applied (or nothing to do), False on failure.
- Return type:
bool
Notes
Empty or missing IDMS items will result in a no-op (returns True).
Deduplication retains first occurrence (existing entries preserved if replace=False).
- create_kubevirt_ocp_cluster(name: str = None, nodepool_replicas: int = 2, memory: str = '12Gi', cpu_cores: int = 6, root_volume_size: str = 40, ocp_version=None, cp_availability_policy=None, infra_availability_policy=None, disable_default_sources=None, auto_repair=True)
Create HyperShift hosted cluster. Default parameters have minimal requirements for the cluster.
- Parameters:
name (str) – Name of the cluster
nodepool_replicas (int) – Number of nodes in the cluster
memory (str) – Memory size of the cluster, minimum 12Gi
cpu_cores (str) – CPU cores of the cluster, minimum 6
ocp_version (str) – OCP version of the cluster
root_volume_size (str) – Root volume size of the cluster, default 40 (Gi is not required)
cp_availability_policy (str) – Control plane availability policy, default HighlyAvailable; if SingleReplica selected, cluster will be created with etcd kube-apiserver, kube-controller-manager, openshift-oauth-apiserver, openshift-controller-manager, kube-scheduler with min available quorum 1 in pdb.
infra_availability_policy (str) – Infra availability policy, default HighlyAvailable, if SingleReplica selected, cluster will be created with etcd ingress controller, monitoring, cloud controller with min available quorum 1 in pdb.
disable_default_sources (bool) – Disable default sources on hosted cluster, such as ‘redhat-operators’
auto_repair (bool) – Enables machine autorepair with machine health checks, default True
- Returns:
Name of the hosted cluster
- Return type:
str
- delete_hcp_and_hypershift_bin()
Delete hcp binary
- destroy_kubevirt_cluster(name)
Destroy HyperShift hosted cluster
- Parameters:
name (str) – Name of the cluster
- download_hosted_cluster_kubeconfig(name: str, hosted_cluster_path: str, from_hcp: bool = True)
Download HyperShift hosted cluster kubeconfig
- Parameters:
name (str) – name of the cluster
hosted_cluster_path (str) – path to create auth_path folder and download kubeconfig there
from_hcp (bool) – if True, use hcp binary to download kubeconfig, otherwise use ocp secret
- Returns:
path to the downloaded kubeconfig, None if failed
- Return type:
str
- get_hosted_cluster_progress(name: str)
Get HyperShift hosted cluster creation progress
- Parameters:
name (str) – name of the cluster
- Returns:
progress status; ‘Completed’ is expected in most cases
- Return type:
str
- get_hypershift_csv_version()
Get hypershift operator version
- Returns:
hypershift operator version
- Return type:
str
- get_mce_version()
Get multicluster engine version
- Returns:
multicluster engine version
- Return type:
str
- hcp_binary_exists()
Check if hcp binary exists
- Returns:
True if hcp binary exists, False otherwise
- Return type:
bool
- hypershift_binary_exists()
Check if hypershift binary exists
- Returns:
True if hypershift binary exists, False otherwise
- Return type:
bool
- hypershift_clusters_exist()
Check if hypershift is installed on the cluster
- Returns:
True if hypershift is installed, False otherwise
- Return type:
bool
- install_hcp_and_hypershift_from_git(install_latest=False)
Install hcp binary from git
- Parameters:
install_latest (bool) – If True, install the latest Hypershift version from git.
False (If) –
hub. (use the configured hcp_version or latest supported version from) –
- install_hypershift_upstream_on_cluster()
Install hypershift on the cluster
- Returns:
True if hypershift is installed, False otherwise
- Return type:
bool
- save_mirrors_list_to_file()
Save IDMS mirrors list to a file Note: here this function has been converted from icsp to idms
- update_hcp_binary(install_latest=False)
Update hcp binary
- Parameters:
install_latest (bool) – If True, install the latest Hypershift version from git.
False (If) –
hcp_version. (use the configured) –
- update_mirrors_list_to_file()
Update IDMS list to a file Note: here this function has been converted from icsp to idms
- verify_hosted_ocp_cluster_from_provider(name)
Verify HyperShift hosted cluster from provider
- Parameters:
name (str) – hosted OCP cluster name
- Returns:
True if hosted OCP cluster is verified, False otherwise
- Return type:
bool
- wait_hosted_cluster_completed(name: str, timeout=3600)
Wait for HyperShift hosted cluster creation to complete
- Parameters:
name – name of the cluster
timeout – timeout in seconds
- Returns:
True if cluster creation completed, False otherwise
- Return type:
bool
- ocs_ci.deployment.helpers.hypershift_base.create_cluster_dir(cluster_name)
Create the kubeconfig directory for the cluster
- Parameters:
cluster_name (str) – Name of the cluster
- Returns:
Path to the kubeconfig directory
- Return type:
str
- ocs_ci.deployment.helpers.hypershift_base.delete_hcp_podman_container()
Delete hcp podman container. This method will not fail if the container does not exist.
- ocs_ci.deployment.helpers.hypershift_base.get_available_hosted_clusters_to_ocp_ver_dict()
Get available HyperShift hosted clusters with their versions
- Returns:
hosted clusters available with their versions. Example: {‘cl-418-x’: ‘4.18.7’, ‘cl-418-c’: ‘4.19.0’}
- Return type:
dict
- ocs_ci.deployment.helpers.hypershift_base.get_binary_hcp_version()
Get hcp version output. Handles hcp 4.16 and 4.17 cmd differences
- Returns:
hcp version output
- Return type:
str
- ocs_ci.deployment.helpers.hypershift_base.get_current_nodepool_size(name)
Get existing nodepool of HyperShift hosted cluster
- Parameters:
name (str) – name of the cluster
- Returns:
number of nodes in the nodepool
- Return type:
str
- ocs_ci.deployment.helpers.hypershift_base.get_desired_nodepool_size(name: str)
Get desired nodepool of HyperShift hosted cluster
- Parameters:
name (str) – of the cluster
- Returns:
number of nodes in the nodepool
- Return type:
int
- ocs_ci.deployment.helpers.hypershift_base.get_hosted_cluster_kubeconfig_name(name: str)
Get HyperShift hosted cluster kubeconfig, for example ‘hcp414-bm2-a-admin-kubeconfig’
- Parameters:
name – name of the cluster
- Returns:
hosted cluster kubeconfig name
- Return type:
str
- ocs_ci.deployment.helpers.hypershift_base.get_hosted_cluster_names()
Get HyperShift hosted cluster names
- Returns:
the list of hosted cluster names
- Return type:
list
- ocs_ci.deployment.helpers.hypershift_base.get_latest_supported_hypershift_version() str | None
Get the latest supported Hypershift version from the hub cluster
- Returns:
latest supported Hypershift version in ‘major.minor’ format, e.g. ‘4.18’ or None in case of failure
- Return type:
str
- ocs_ci.deployment.helpers.hypershift_base.get_random_hosted_cluster_name()
Get a random cluster name
- Returns:
random cluster name
- Return type:
str
- ocs_ci.deployment.helpers.hypershift_base.kubeconfig_exists_decorator(func)
Decorator to check if the kubeconfig exists before executing the decorated method
- Parameters:
func – Function to decorate. Should be used only for methods of a class having a ‘cluster_kubeconfig’ attribute.
- Returns:
The decorated function.
- Return type:
wrapper
- ocs_ci.deployment.helpers.hypershift_base.wait_for_worker_nodes_to_be_ready(name: str, timeout: int = 2400)
Wait for worker nodes to be ready for HyperShift hosted cluster
- Parameters:
name (str) – name of the cluster
timeout (int) – timeout in seconds
- Returns:
True if worker nodes are ready, False otherwise
- Return type:
bool
- ocs_ci.deployment.helpers.hypershift_base.worker_nodes_deployed(name: str)
Check if worker nodes are deployed for HyperShift hosted cluster
- Parameters:
name (str) – name of the cluster
- Returns:
True if worker nodes are deployed, False otherwise
- Return type:
bool
ocs_ci.deployment.helpers.icsp_parser module
- class ocs_ci.deployment.helpers.icsp_parser.ImageContentItem(apiVersion=None, kind=None, metadata=None, spec=None, **kwargs)
Bases:
objectImageContentItem object to parse the ImageContentSourcePolicy CR in dict format to a file
- class ocs_ci.deployment.helpers.icsp_parser.ImageContentMetadata(annotations=None, creationTimestamp=None, generation=None, name=None, resourceVersion=None, uid=None, **kwargs)
Bases:
objectImageContentMetadata object to parse the ImageContentSourcePolicy CR in dict format to a file
- class ocs_ci.deployment.helpers.icsp_parser.ImageContentSourcePolicy(apiVersion=None, items=None, kind=None, metadata=None, **kwargs)
Bases:
objectImageContentSourcePolicy object to parse the ImageContentSourcePolicy CR in dict format to a file Main purpose is to use parse_ICSP_json_to_mirrors_file and create a file with mirrors and their sources in format required for the ‘hcp’ or ‘hypershift’ binaries
- class ocs_ci.deployment.helpers.icsp_parser.ImageContentSpec(repositoryDigestMirrors, **kwargs)
Bases:
objectImageContentSpec object to parse the ImageContentSourcePolicy CR in dict format to a file
- class ocs_ci.deployment.helpers.icsp_parser.RepositoryDigestMirror(mirrors=None, source=None, **kwargs)
Bases:
objectRepositoryDigestMirror object to parse the ImageContentSourcePolicy CR in dict format to a file
- ocs_ci.deployment.helpers.icsp_parser.parse_ICSP_json_to_mirrors_file(icsp_json_dict, file_path)
Parse the ImageContentSourcePolicy object to a file :param icsp_json_dict: ImageContentSourcePolicy CR in dict format :param file_path: file path to write the mirrors to
- ocs_ci.deployment.helpers.icsp_parser.parse_image_content_source_policy(image_content_source_policy)
Parse the image content source policy :param image_content_source_policy: image content source policy
- Returns:
ImageContentSourcePolicy object
- ocs_ci.deployment.helpers.icsp_parser.write_mirrors_to_file(file_path, mirrors_to_source_list)
Write the mirrors to a file :param file_path: file path to write the mirrors to :param mirrors_to_source_list: mirrors and their sources to write to the file, list of mirrors and their sources
ocs_ci.deployment.helpers.idms_parser module
- class ocs_ci.deployment.helpers.idms_parser.ImageContentItem(apiVersion=None, kind=None, metadata=None, spec=None, **kwargs)
Bases:
objectImageContentItem object to parse the ImageDigestMirrorSet CR in dict format to a file
- class ocs_ci.deployment.helpers.idms_parser.ImageContentMetadata(annotations=None, creationTimestamp=None, generation=None, name=None, resourceVersion=None, uid=None, **kwargs)
Bases:
objectImageContentMetadata object to parse the ImageDigestMirrorSet CR in dict format to a file
- class ocs_ci.deployment.helpers.idms_parser.ImageContentSpec(imageDigestMirrors, **kwargs)
Bases:
objectImageContentSpec object to parse the ImageDigestMirrorSet CR in dict format to a file
- class ocs_ci.deployment.helpers.idms_parser.ImageDigestMirror(mirrors=None, source=None, **kwargs)
Bases:
objectImageDigestMirror object to parse the ImageDigestMirrorSet CR in dict format to a file
- class ocs_ci.deployment.helpers.idms_parser.ImageDigestMirrorSet(apiVersion=None, items=None, kind=None, metadata=None, **kwargs)
Bases:
objectImageDigestMirrorSet object to parse the ImageDigestMirrorSet CR in dict format to a file Main purpose is to use parse_IDMS_json_to_mirrors_file and create a file with mirrors and their sources in format required for the ‘hcp’ or ‘hypershift’ binaries
- ocs_ci.deployment.helpers.idms_parser.extract_image_content_sources(idms_json_dict)
Extract imageContentSources list (for HostedCluster spec) from ImageDigestMirrorSet JSON.
- Parameters:
idms_json_dict (dict) – Output of ‘oc get imagedigestmirrorsets -o json’ parsed as dict
- Returns:
imageContentSources entries (possibly empty)
- Return type:
list[dict]
- ocs_ci.deployment.helpers.idms_parser.parse_IDMS_json_to_mirrors_file(idms_json_dict, file_path)
Parse the ImageDigestMirrorSet object to a file :param idms_json_dict: ImageDigestMirrorSet CR in dict format :param file_path: file path to write the mirrors to
- ocs_ci.deployment.helpers.idms_parser.parse_image_digest_mirror_set(image_digest_mirror_set)
Parse the image content source policy :param image_digest_mirror_set: image content source policy
- Returns:
ImageDigestMirrorSet object
- ocs_ci.deployment.helpers.idms_parser.write_mirrors_to_file(file_path, mirrors_to_source_list)
Write the mirrors to a file :param file_path: file path to write the mirrors to :param mirrors_to_source_list: mirrors and their sources to write to the file, list of mirrors and their sources
ocs_ci.deployment.helpers.lso_helpers module
This module contains helpers functions needed for LSO ( local storage operator ) deployment.
- ocs_ci.deployment.helpers.lso_helpers.add_disk_for_rhv_platform()
Add disk for RHV platform
- ocs_ci.deployment.helpers.lso_helpers.add_disk_for_vsphere_platform()
Add RDM/VMDK disk for vSphere platform
- ocs_ci.deployment.helpers.lso_helpers.catalog_source_created(catalogsource_name, namespace=None)
Check if catalog source is created
- Returns:
True if catalog source is created, False otherwise
- Return type:
bool
- ocs_ci.deployment.helpers.lso_helpers.cleanup_nodes_for_lso_install()
Cleanup before installing lso
- ocs_ci.deployment.helpers.lso_helpers.create_optional_operators_catalogsource_non_ga(force=False)
Creating optional operators CatalogSource and ImageContentSourcePolicy for non-ga OCP. If platform is hci_baremetal then force delete static pods to apply the changes and wait machines in machineconfig pool are ready. If the platform is hci_baremetal we force-delete vm and hcp pods if wait for ready Machines is not successful.
- Parameters:
force (bool) – enable/disable lso catalog setup
- ocs_ci.deployment.helpers.lso_helpers.get_device_paths(worker_names)
Retrieve a list of the device paths for each worker node
- Parameters:
worker_names (list) – worker node names
- Returns:
device path ids
- Return type:
list
- ocs_ci.deployment.helpers.lso_helpers.lso_operator_installed(namespace=None)
” Check lso operator is installed or not
- Returns:
True if Local Storage instance is created, False otherwise
- Return type:
bool
- ocs_ci.deployment.helpers.lso_helpers.lso_upgrade()
Upgrade lso operator
- ocs_ci.deployment.helpers.lso_helpers.running_lso_version(namespace=None)
This method is to fetch the running lso version
- Returns:
metalLB version
- Return type:
string
- ocs_ci.deployment.helpers.lso_helpers.setup_local_storage(storageclass)
Setup the necessary resources for enabling local storage.
- Parameters:
storageclass (string) – storageClassName value to be used in LocalVolume CR based on LOCAL_VOLUME_YAML
- ocs_ci.deployment.helpers.lso_helpers.verify_pvs_created(expected_pvs, storageclass, exact_count_pvs=True)
Verify that PVs were created and are in the Available state
- Parameters:
expected_pvs (int) – number of PVs to verify
storageclass (str) – Name of storageclass
exact_count_pvs (bool) – True if expected_pvs should match exactly with PVs created, False, if PVs created is more than or equal to expected_pvs
- Raises:
AssertionError – if any PVs are not in the Available state or if the number of PVs does not match the given parameter.
ocs_ci.deployment.helpers.mcg_helpers module
This module contains helper functions which is needed for MCG only deployment
- ocs_ci.deployment.helpers.mcg_helpers.check_if_mcg_root_secret_public()
Verify if MCG root secret is public
- Returns:
False if the secrets are not public and True otherwise
- ocs_ci.deployment.helpers.mcg_helpers.check_if_mcg_secrets_in_env()
Verify if mcg secrets are used in noobaa app environment variable except for the POSTGRES/POSTGRESQL
- Returns:
True if secrets are used in env variable else False
- ocs_ci.deployment.helpers.mcg_helpers.mcg_only_deployment()
Creates cluster with MCG only deployment
- ocs_ci.deployment.helpers.mcg_helpers.mcg_only_post_deployment_checks()
Verification of MCG only after deployment
ocs_ci.deployment.helpers.odf_deployment_helpers module
This module contains helpers functions needed for ODF deployment.
- ocs_ci.deployment.helpers.odf_deployment_helpers.get_required_csvs()
Get the mandatory CSVs needed for the ODF cluster
- Returns:
list of CSVs needed
- Return type:
list
- ocs_ci.deployment.helpers.odf_deployment_helpers.is_storage_system_needed()
Checks whether creation of storage system is needed or not
- Returns:
True if storage system is need, otherwise False
- Return type:
bool
- ocs_ci.deployment.helpers.odf_deployment_helpers.set_ceph_config(entity, config_name, value)
Sets the ceph config values
- Parameters:
entity (str) – The Ceph entity like “osd”, “mon”, “mds”, etc. but can be “global” as well.
config_name (str) – Name of the Ceph config option (e.g., “bluestore_slow_ops_warn_lifetime”).
value (str) – The value to set for the config.
- ocs_ci.deployment.helpers.odf_deployment_helpers.set_ceph_mclock_balanced_profile(osd_ids=None)
Apply the ‘balanced’ mClock profile to specified OSDs (or all OSDs if not provided).
- Parameters:
osd_ids (list) – List of OSD IDs. If None, the profile is applied to all OSDs.
- Raises:
CommandFailed – If enabling override or setting the profile fails.
- ocs_ci.deployment.helpers.odf_deployment_helpers.set_ceph_mclock_config_profile(profile_name, osd_ids=None)
Set the Ceph mClock profile for the specified OSDs.
If no OSDs are specified, the profile is applied to all OSDs in the cluster.
- Parameters:
profile_name (str) – The mClock profile to set (‘balanced’, ‘high_client_ops’, ‘high_recovery_ops’).
osd_ids (list) – List of OSD IDs. If None, the profile is applied to all OSDs.
- Raises:
ValueError – If the given profile name is invalid.
CommandFailed – If enabling override or setting the profile fails.
- ocs_ci.deployment.helpers.odf_deployment_helpers.set_ceph_mclock_high_client_recovery_profile(osd_ids=None)
Apply the ‘high_client_ops’ mClock profile to specified OSDs (or all OSDs if not provided).
- Parameters:
osd_ids (list) – List of OSD IDs. If None, the profile is applied to all OSDs.
- Raises:
CommandFailed – If enabling override or setting the profile fails.
- ocs_ci.deployment.helpers.odf_deployment_helpers.set_ceph_mclock_high_recovery_profile(osd_ids=None)
Apply the ‘high_recovery_ops’ mClock profile to specified OSDs (or all OSDs if not provided).
- Parameters:
osd_ids (list) – List of OSD IDs. If None, the profile is applied to all OSDs.
- Raises:
CommandFailed – If enabling override or setting the profile fails.
ocs_ci.deployment.helpers.prechecks module
This module contains the pre-checks needed for deployment. Some of the common pre-checks are memory, CPU and storage. If the minimum requirements are not satisfied in the target environment, there is no need to proceed with deployment. This module is mainly intended for on-prem platforms.
- class ocs_ci.deployment.helpers.prechecks.BareMetalPreChecks
Bases:
PreCheckspre-checks for Bare Metal platform (PSI environment)
- cpu_check()
CPU checks
- get_all_checks()
Aggregate all the checks needed for BM platform
- memory_check()
Memory checks
- network_check()
Network related checks
- storage_check()
Storage checks
- class ocs_ci.deployment.helpers.prechecks.PreChecks
Bases:
objectA base class for pre-checks. Should be inherited by specific platform classes
- cpu_check()
- memory_check()
- network_check()
- storage_check()
- class ocs_ci.deployment.helpers.prechecks.VSpherePreChecks
Bases:
PreChecksPre-checks for vSphere platform
- cpu_check()
CPU checks
- get_all_checks()
Aggregate all the checks needed for vSphere platform
- memory_check()
Memory checks
- network_check()
Network related checks
- pre_req()
Pre-Requisites for vSphere checks
- storage_check()
Checks for storage capacity in the datastore
- Raises:
StorageNotSufficientException – In case if there is no sufficient storage in Datastore.
- template_check()
Checks whether template exists in Datacenter or not for UPI deployments
- Raises:
TemplateNotFound – If template not found in Datacenter.
ocs_ci.deployment.helpers.rosa_cluster_helpers module
This module contains helper classes related to Managed Service ROSA Clusters in different environments.
- class ocs_ci.deployment.helpers.rosa_cluster_helpers.ROSAEnvCluster(cluster, env_prefix)
Bases:
objectA helper class for Managed Service ROSA Clusters in any environment.
- cluster_admin_login(skip_tls_verify=False)
Logs in to the cluster as admin.
- Parameters:
skip_tls_verify (bool) – If True, bypasses the certificate check and uses insecure connections.
- Returns:
Output of the oc login command.
- Return type:
str
- create_admin_and_login()
Creates an admin account for the cluster and logs in.
- create_username_file()
Creates a file with the username for the cluster.
- generate_kubeadmin_password_file(path=None)
Creates a kubeadmin password file for the cluster.
- Parameters:
path (str) – Path to create the kubeadmin password file.
- generate_kubeconfig_file(path=None, skip_tls_verify=False)
Creates a kubeconfig file for the cluster.
- Parameters:
path (str) – Path to create the kubeconfig file.
skip_tls_verify (bool) – If True, bypasses the certificate check and uses insecure connections.
- get_admin_name()
Get the admin username for the cluster.
- Returns:
Admin username for the cluster.
- Return type:
str
- get_admin_password()
Get the admin password for the cluster.
- Returns:
Admin password for the cluster.
- Return type:
str
- wait_for_cluster_admin_login_successful()
Waits for the admin login to be successful.
- Raises:
ROSAAdminLoginFailedException – If admin fails to log in to the cluster.
- class ocs_ci.deployment.helpers.rosa_cluster_helpers.ROSAProdEnvCluster(cluster)
Bases:
ROSAEnvClusterA helper class for Managed Service ROSA Clusters in the Production Environment.
- class ocs_ci.deployment.helpers.rosa_cluster_helpers.ROSAStageEnvCluster(cluster)
Bases:
ROSAEnvClusterA helper class for Managed Service ROSA Clusters in the Stage Environment.
ocs_ci.deployment.helpers.storage_class module
- ocs_ci.deployment.helpers.storage_class.create_custom_storageclass(storage_class_path: str) str
Create a custom storageclass using the yaml file defined at the storage_class_path
- Parameters:
storage_class_path (str) – Filepath to storageclass yaml definition
- Returns:
Name of the storageclass
- Return type:
str
- ocs_ci.deployment.helpers.storage_class.get_storageclass() str
Retrieve the storageclass to use from the config or based on platform
- Returns:
Name of the storageclass
- Return type:
str
ocs_ci.deployment.helpers.vsphere_helpers module
This module contains helpers functions needed for deployment of clusters on vsphere platform.
- class ocs_ci.deployment.helpers.vsphere_helpers.VSPHEREHELPERS
Bases:
objectHelper class for vSphere
- generate_cluster_info()
Generates the cluster information file
- generate_config_yaml()
Generate config yaml file
- generate_terraform_vars_for_scaleup(rhcos_ips)
Generates the terraform variables file for scaling nodes
- get_host_file_for_time_sync()
Fetches the host file for time sync
- Returns:
host file
- Return type:
str
- modify_scaleup_repo()
Modify the scale-up repo. Considering the user experience, removing the access and secret keys and variable from appropriate location in the scale-up repo