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: object

Helper for External RHCS cluster

create_object_store_user()

Create object store user on external cluster and update access_key and secret_key to config

enable_secure_connection_mode()

Enables secure connection mode for RHCS cluster

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

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

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_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.generate_exporter_script()

Generates exporter script for RHCS cluster

Returns:

path to the exporter script

Return type:

str

ocs_ci.deployment.helpers.external_cluster_helpers.get_and_apply_rgw_cert_ca()

Downloads CA Certificate of RGW if SSL is used and apply it to be trusted by the OCP cluster

Returns:

path to the downloaded RGW Cert CA

Return type:

str

ocs_ci.deployment.helpers.external_cluster_helpers.get_external_cluster_client()

Finding the client role node IP address.

Returns:

IP address, user, password of the client, 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_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.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.create_optional_operators_catalogsource_non_ga(force=False)

Creating optional operators CatalogSource and ImageContentSourcePolicy for non-ga OCP.

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.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.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.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: PreChecks

pre-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: object

A 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: PreChecks

Pre-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_prod_cluster_helpers module

This module contains helpers class related to Managed Service ROSA Clusters in production environment

class ocs_ci.deployment.helpers.rosa_prod_cluster_helpers.ROSAProdEnvCluster(cluster)

Bases: object

A helper class for Managed Service ROSA Cluster in Production Environment

cluster_admin_login(skip_tls_verify=False)

Login to production cluster

Parameters:

skip_tls_verify (bool) – True to bypass the certificate check and use insecure connections

Returns:

output of oc login command

Return type:

str

create_admin_and_login()

creates admin account for cluster and login

generate_kubeadmin_password_file(path=None)

creates kubeadmin password file for cluster

Parameters:

path (str) – Path to create kubeadmin password file

generate_kubeconfig_file(path=None, skip_tls_verify=False)

creates kubeconfig file for the cluster

Parameters:
  • path (str) – Path to create kubeconfig file

  • skip_tls_verify (bool) – True to bypass the certificate check and use insecure connections

wait_for_cluster_admin_login_successful()

Waits for the admin to login successfully

Raises:

ROSAProdAdminLoginFailedException – in case of admin failed to log in cluster

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: object

Helper 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

Module contents