ocs_ci.deployment package

Subpackages

Submodules

ocs_ci.deployment.acm module

All ACM related deployment classes and functions should go here.

class ocs_ci.deployment.acm.Submariner

Bases: object

Submariner configuaration and deployment

create_acm_brew_idms()

This is a prereq for downstream unreleased submariner

deploy()
deploy_downstream()
deploy_upstream()
download_binary()
download_downstream_binary(download_url='registry.redhat.io/rhacm2/')

Download downstream subctl binary

Raises:

UnsupportedPlatformError – If current platform has no supported subctl binary

get_default_gateway_node()

Return the default node to be used as submariner gateway

Returns:

Name of the gateway node

Return type:

str

get_primary_cluster_index()

Return list index (in the config list) of the primary cluster A cluster is primary from DR perspective

Returns:

Index of the cluster designated as primary

Return type:

int

get_subctl_version()

Run ‘subctl version ‘ command and return a Version object

Returns:

semanctic version object

Return type:

vers (Version)

submariner_configure_upstream()

Deploy and Configure upstream submariner

Raises:

DRPrimaryNotFoundException – If there is no designated primary cluster found

wait_for_tar_file(subctl_download_tar_file)
  1. First check if file exists

  2. Check if file is accessible

  3. check if tarfile is intact

ocs_ci.deployment.acm.run_subctl_cmd(cmd=None)

Run subctl command

Parameters:

cmd – subctl command to be executed

ocs_ci.deployment.acm.run_subctl_cmd_interactive(cmd, prompt, answer)

Handle interactive prompts with answers during subctl command

Parameters:
  • cmd (str) – Command to be executed

  • prompt (str) – Expected question during command run which needs to be provided

  • answer (str) – Answer for the prompt

Raises:

InteractivePromptException – in case something goes wrong

ocs_ci.deployment.assisted_installer module

This module implements functionality for deploying OCP cluster via Assisted Installer

class ocs_ci.deployment.assisted_installer.AssistedInstallerCluster(name, cluster_path, existing_cluster=False, openshift_version=None, base_dns_domain=None, api_vip=None, ingress_vip=None, ssh_public_key=None, pull_secret=None, cpu_architecture='x86_64', high_availability_mode='Full', image_type='minimal-iso', static_network_config=None)

Bases: object

create_cluster()

Create (register) new cluster in Assisted Installer console

create_infrastructure_environment()

Create new Infrastructure Environment for the cluster

create_kubeadmin_password_file()

Export password for kubeadmin to auth/kubeadmin-password file in cluster path

create_kubeconfig_file()

Export kubeconfig to auth directory in cluster path.

create_metadata_file()

Create metadata.json file.

create_openshift_install_log_file()

Create .openshift_install.log file containing URL to OpenShift console. It is used by our CI jobs to show the console URL in build description.

delete_cluster()

Delete the cluster

delete_infrastructure_environment()

Delete the Infrastructure Environment

download_discovery_iso(local_path)

Download the discovery iso image

Parameters:

local_path (str) – path where to store the discovery iso image

download_ipxe_config(local_path)

Download the ipxe config for discovery boot

Parameters:

local_path (str) – path where to store the ipxe config

Returns:

path to the downloaded ipxe config file

Return type:

str

get_host_id_mac_mapping()

Prepare mapping between host ID and mac addresses

Returns:

host id to mac mapping ([[host1_id, mac1], [host1_id, mac2], [host2_id, mac3],…])

Return type:

list of lists

get_infra_env_hosts()
Returns:

list of discovered hosts in the Infrastructure Environment

Return type:

list

install_cluster(pending_user_action_handler=None)

Trigger cluster installation

Parameters:

pending_user_action_handler (function) – function handling pending user action for particular host (host details as dict provided as first parameter)

load_existing_cluster_configuration()

Load configuration from existing cluster

prepare_pull_secret(original_pull_secret)

Combine original pull secret with the pull secret for the Assisted Installer console user. We have to replace cloud.openshift.com credentials in the original pull-secret with the credentials for the current user, otherwise Assisted Installer will comply that the pull secret belongs to different user.

Parameters:

original_pull_secret (str or dict) – content of pull secret

update_hosts_config(mac_name_mapping, mac_role_mapping)

Update host names and roles.

Parameters:
  • mac_name_mapping (dict) – host mac address to host name mapping

  • mac_role_mapping (dict) – host mac address to host role mapping

verify_validations_info_for_discovered_nodes()

Check and verify validations info for the discovered nodes.

wait_for_discovered_nodes(expected_nodes)

Wait for expected number of nodes to appear in the Assisted Installer infra/cluster

Parameters:

expected_nodes (int) – number of expected nodes

ocs_ci.deployment.aws module

This module contains platform specific methods and classes for deployment on AWS platform

class ocs_ci.deployment.aws.AWSIPI

Bases: AWSBase

A class to handle AWS IPI specific deployment

class OCPDeployment

Bases: IPIOCPDeployment

deploy_prereq()

Overriding deploy_prereq from parent. Perform all necessary prerequisites for cloud IPI here.

sts_setup()

Perform setup procedure for STS Mode deployments.

deploy_ocp(log_cli_level='DEBUG')

Deployment specific to OCP cluster on this platform

Parameters:

log_cli_level (str) – openshift installer’s log level (default: “DEBUG”)

destroy_cluster(log_level='DEBUG')

Destroy OCP cluster specific to AWS IPI

Parameters:

log_level (str) – log level openshift-installer (default: DEBUG)

class ocs_ci.deployment.aws.AWSUPI

Bases: AWSBase

A class to handle AWS UPI specific deployment

class OCPDeployment

Bases: OCPDeployment

deploy(log_cli_level='DEBUG')

Exact deployment will happen here

Parameters:

log_cli_level (str) – openshift installer’s log level (default: “DEBUG”)

deploy_prereq()

Overriding deploy_prereq from parent. Perform all necessary prerequisites for AWSUPI here.

add_rhel_workers()

Add RHEL worker nodes to the existing cluster

build_ansible_inventory(hosts)

Build the ansible hosts file from jinja template

Parameters:

hosts (list) – list of private host names

Returns:

path of the ansible file created

Return type:

str

check_connection(rhel_pod_obj, host, pem_dst_path)
create_rhel_instance()

This function does the following: 1. Create RHEL worker instances, copy required AWS tags from existing 2. worker instances to new RHEL instances 3. Copy IAM role from existing worker to new RHEL workers

deploy_ocp(log_cli_level='DEBUG')

OCP deployment specific to AWS UPI

Parameters:

log_cli_level (str) – openshift installer’s log level (default: ‘DEBUG’)

destroy_cluster(log_level='DEBUG')

Destroy OCP cluster for AWS UPI

Parameters:

log_level (str) – log level for openshift-installer ( default:DEBUG)

gather_worker_data(suffix='no0')

Gather various info like vpc, iam role, subnet,security group, cluster tag from existing RHCOS workers

Parameters:

suffix (str) – suffix to get resource of worker node, ‘no0’ by default

get_kube_tag(tags)

Fetch kubernets.io tag from worker instance

Parameters:

tags (dict) – AWS tags from existing worker

Returns:

key looks like

”kubernetes.io/cluster/<cluster-name>” and value looks like “share” OR “owned”

Return type:

tuple

get_ready_status(node_ent)

Get the node ‘Ready’ status

Parameters:

node_ent (dict) – Node info which includes details

Returns:

True if node is Ready else False

Return type:

bool

get_rhcos_workers()

Returns a list of rhcos worker names

Returns:

list of rhcos worker nodes

Return type:

rhcos_workers (list)

get_worker_resource_id(resource)

Get the resource ID

Parameters:

resource (dict) – a dictionary of stack resource

Returns:

ID of worker stack resource

Return type:

str

remove_rhcos_workers()

After RHEL workers are added remove rhcos workers from the cluster

Raises:

FailedToRemoveNodeException – if rhcos removal is failed

run_ansible_playbook()

Bring up a helper pod (RHEL) to run openshift-ansible playbook

verify_nodes_added(hosts)

Verify RHEL workers are added

Parameters:

hosts (list) – list of aws private hostnames

Raises:

FailedToAddNodeException – if node addition failed

ocs_ci.deployment.azure module

This module contains platform specific methods and classes for deployment on Azure platform.

class ocs_ci.deployment.azure.AZUREIPI

Bases: AZUREBase

A class to handle Azure IPI specific deployment.

class OCPDeployment

Bases: IPIOCPDeployment

deploy_prereq()

Overriding deploy_prereq from parent. Perform all necessary prerequisites for cloud IPI here.

sts_setup()

Perform setup procedure for STS Mode deployments.

destroy_cluster(log_level='DEBUG')

Destroy OCP cluster specific to Azure IPI

Parameters:

log_level (str) – log level openshift-installer (default: DEBUG)

ocs_ci.deployment.baremetal module

class ocs_ci.deployment.baremetal.BAREMETALAI

Bases: BAREMETALBASE

A class to handle Bare metal Assisted Installer specific deployment

class OCPDeployment

Bases: BMBaseOCPDeployment

configure_ipxe_on_helper()

Configure iPXE on helper node

create_config()

Create the OCP deploy config.

create_dns_records()

Configure DNS records for api and ingress

create_pxe_file(template='ocp-deployment/pxelinux.cfg.ipxe.j2', **kwargs)

Prepare content of PXE file for chain loading to ipxe

deploy(log_cli_level='DEBUG')

Deployment specific to OCP cluster on this platform

Parameters:

log_cli_level (str) – not used for Assisted Installer deployment

deploy_prereq()

Pre-Requisites for Bare Metal AI Deployment

destroy()

Cleanup cluster related resources.

pending_user_action_handler(host)

Method for handling pending user action during deployment (this usually means that the server didn’t boot properly from the disk.)

Parameters:

host (dict) – details about host with pending user action (from Assisted Installer api)

set_pxe_boot_and_reboot(machine)

Ipmi Set Pxe boot and Restart the machine

Parameters:

machine (str) – Machine Name

destroy_cluster(log_level='DEBUG')

Destroy OCP cluster specific to Baremetal - Assisted installer deployment

Parameters:

log_level (str) – this parameter is not used here

class ocs_ci.deployment.baremetal.BAREMETALBASE

Bases: Deployment

A common class for Bare metal deployments

class ocs_ci.deployment.baremetal.BAREMETALUPI

Bases: BAREMETALBASE

A class to handle Bare metal UPI specific deployment

class OCPDeployment

Bases: BMBaseOCPDeployment

configure_storage_for_image_registry(kubeconfig)

Configures storage for the image registry

create_config()

Creates the OCP deploy config for the Bare Metal

create_ignitions()

Creates the ignition files

create_manifest()

Creates the Manifest files

create_pxe_files(ocp_version, role, disk_path)

Create pxe file for giver role

Parameters:
  • ocp_version (float) – OCP version

  • role (str) – Role of node eg:- bootstrap,master,worker

Returns:

temp file path

Return type:

str

deploy(log_cli_level='DEBUG')

Deploy

deploy_prereq()

Pre-Requisites for Bare Metal UPI Deployment

destroy(log_level='')

Destroy OCP cluster specific to BM UPI

set_pxe_boot_and_reboot(machine)

Ipmi Set Pxe boot and Restart the machine

Parameters:

machine (str) – Machine Name

class ocs_ci.deployment.baremetal.BMBaseOCPDeployment

Bases: OCPDeployment

check_bm_status_exist()

Check if BM Cluster already exist

Returns:

response status

Return type:

str

configure_dnsmasq_common_config()

Prepare common configuration for dnsmasq

configure_dnsmasq_hosts_config()

prepare hosts configuration for dnsmasq dhcp

configure_dnsmasq_on_helper_vm()

Install and configure dnsmasq and other required packages for DHCP and PXE boot server on helper VM

configure_dnsmasq_pxe_config()

Prepare PXE configuration for dnsmasq

deploy_prereq()

Pre-Requisites for Bare Metal deployments

destroy(log_level='')

Destroy OCP cluster

get_locked_username()

Get name of user who has locked baremetal resource

Returns:

username

Return type:

str

property helper_node_handler

Create connection to helper node hosting httpd, tftp and dhcp services for PXE boot

restart_dnsmasq_service_on_helper_vm()

Restart dnsmasq service providing DHCP and TFTP services for UPI deployment

start_dnsmasq_service_on_helper_vm()

Start dnsmasq service providing DHCP and TFTP services for UPI deployment

stop_dnsmasq_service_on_helper_vm()

Stop dnsmasq service providing DHCP and TFTP services for UPI deployment

update_bm_status(bm_status)

Update BM status when cluster is deployed/teardown

Parameters:

bm_status (str) – Status to be updated

Returns:

response message

Return type:

str

class ocs_ci.deployment.baremetal.BaremetalPSIUPI

Bases: Deployment

All the functionalities related to BaremetalPSI- UPI deployment lives here

class OCPDeployment

Bases: OCPDeployment

deploy(log_level='')

Implement ocp deploy in specific child class

deploy_prereq()

Instantiate proper flexy class here

destroy(log_level='')

Destroy volumes attached if any and then the cluster

ocs_ci.deployment.baremetal.clean_disk(worker, namespace='default')

Perform disk cleanup

Parameters:
  • worker (object) – worker node object

  • namespace (str) – namespace where the oc_debug command will be executed

ocs_ci.deployment.baremetal.disks_available_to_cleanup(worker, namespace='default')

disks available for cleanup

Parameters:
  • worker (object) – worker node object

  • namespace (str) – namespace where the oc_debug command will be executed

Returns:

The disk names available for cleanup on a node

Return type:

disk_names_available_for_cleanup (list)

ocs_ci.deployment.cert_manager module

This module contains functions needed for installing cert-manager operator from Red Hat. More information about cert-manager can be found at https://github.com/openshift/cert-manager-operator and https://cert-manager.io/

ocs_ci.deployment.cert_manager.deploy_cert_manager()

Installs cert-manager

ocs_ci.deployment.cloud module

This module contains common code and a base class for any cloud platform deployment.

class ocs_ci.deployment.cloud.CloudDeploymentBase

Bases: Deployment

Base class for deployment on a cloud platform (such as AWS, Azure, …).

check_cluster_existence(cluster_name_prefix)

Check cluster existence according to cluster name prefix

Returns:

True if a cluster with the same name prefix already exists,

False otherwise

Return type:

bool

deploy_ocp(log_cli_level='DEBUG')

Deployment specific to OCP cluster on a cloud platform.

Parameters:

log_cli_level (str) – openshift installer’s log level (default: “DEBUG”)

class ocs_ci.deployment.cloud.IPIOCPDeployment

Bases: OCPDeployment

Common implementation of IPI OCP deployments for cloud platforms.

deploy(log_cli_level='DEBUG')

Deployment specific to OCP cluster on a cloud platform.

Parameters:

log_cli_level (str) – openshift installer’s log level (default: “DEBUG”)

deploy_prereq()

Overriding deploy_prereq from parent. Perform all necessary prerequisites for cloud IPI here.

ocs_ci.deployment.cnv module

This module contains functionality required for CNV installation.

class ocs_ci.deployment.cnv.CNVInstaller

Bases: object

CNV Installer class for CNV deployment

catalog_source_created(catalogsource_name=None)

Check if catalog source is created

Parameters:

catalogsource_name (str) – Name of the catalogsource

Returns:

True if catalog source is created, False otherwise

Return type:

bool

check_cnv_is_upgradable()

This method checks if the cnv operator is upgradable or not

Returns:

Returns True if Upgradable else False

Return type:

cnv_upgradeable (bool))

check_hyperconverged_healthy(raise_exception=True)

Validate that HyperConverged systemHealthStatus is healthy. Method throws an exception if the status is not healthy.

Parameters:
  • raise_exception – If True, allow the verification to fail the job and raise an exception if the

  • fails (verification) –

  • False. (otherwise return) –

Returns:

True if the status is healthy, False otherwise.

Return type:

bool

check_if_any_vm_and_vmi(namespace=None)

Checks if any VMs and VM instances are running

Parameters:

namespace (str) – namespace to check

Returns:

True if any VMs or VMi else False

check_virtctl_compatibility()

Check if the virtctl binary is compatible with the current system.

Raises:

exceptions.ArchitectureNotSupported – If virtctl is not compatible.

cnv_hyperconverged_installed()

Check if CNV HyperConverged is already installed. :returns: True if CNV HyperConverged is installed, False otherwise :rtype: bool

create_cnv_catalog_source()

Creates a nightly catalogsource manifest for CNV operator deployment from quay registry.

create_cnv_namespace()

Creates the namespace for CNV resources

Raises:

CommandFailed – If the ‘oc create’ command fails.

create_cnv_operatorgroup()

Creates an OperatorGroup for CNV

create_cnv_subscription()

Creates subscription for CNV operator

deploy_cnv(check_cnv_deployed=False, check_cnv_ready=False)

Installs CNV enabling software emulation.

Parameters:
  • check_cnv_deployed (bool) – If True, check if CNV is already deployed. If so, skip the deployment.

  • check_cnv_ready (bool) – If True, check if CNV is ready. If so, skip the deployment.

deploy_hyper_converged()

Deploys the HyperConverged CR.

Raises:

TimeoutExpiredError – If the HyperConverged resource does not become available within the specified time.

disable_multicluster_engine()

Disable multicluster engine on cluster

download_and_extract_virtctl_binary(bin_dir=None)

Download and extract the virtctl binary to bin_dir

Parameters:

bin_dir (str) – The directory to store the virtctl binary.

enable_software_emulation()

Enable software emulation. This is needed on a cluster where the nodes do not support hardware emulation.

Note that software emulation, when enabled, is only used as a fallback when hardware emulation is not available. Hardware emulation is always attempted first, regardless of the value of the useEmulation.

get_running_cnv_version()

Get the currently deployed cnv version

Returns:

cnv version

Return type:

string

Get all the URL links from virtctl specification links.

Returns:

A list of virtctl download URLs.

Return type:

List[str]

Raises:

exceptions.ResourceNotFoundError – If no URL entries are found.

Retrieve the specification links for the virtctl client.

Returns:

A list of dictionaries containing specification links.

Return type:

List[dict]

Raises:

exceptions.ResourceNotFoundError – If virtctl ConsoleCLIDownload is not found.

get_virtctl_download_url(os_type, os_machine_type)

Get the virtctl download URL based on the specified platform and architecture.

Parameters:
  • os_type (str) – The operating system.

  • os_machine_type (str) – The operating system machine architecture.

Returns:

The virtctl download URL if found, otherwise None.

Return type:

Optional[str]

post_install_verification(raise_exception=False)

Performs CNV post-installation verification, with raise_exception = False may be used safely to run on clusters with CNV installed or not installed.

Parameters:

raise_exception – If True, allow function to fail the job and raise an exception. If false, return False

instead of raising an exception.

Returns:

True if the verification conditions are met, False otherwise

Return type:

bool

Raises:
  • TimeoutExpiredError – If the verification conditions are not met within the timeout

  • and raise_exception is True.

  • HyperConvergedHealthException – If the HyperConverged cluster health is not health

  • and raise_exception is True.

  • ResourceNotFoundError if the namespace does not exist and raise_exception is True.

  • ResourceWrongStatusException if the nodes are not ready, verification fails and raise_exception

  • is True.

remove_cnv_csv()

Remove CNV ClusterServiceVersion

remove_cnv_operator()

Remove CNV operator

remove_cnv_subscription()

Remove CNV subscription

remove_crds()

Remove openshift virtualization CRDs

remove_hyperconverged()

Remove HyperConverged CR

remove_namespace()

Remove openshift virtualization namespace

uninstall_cnv(check_cnv_installed=True)

Uninstall CNV deployment

Parameters:

check_cnv_installed (bool) – True if want to check if CNV installed

upgrade_cnv()

Upgrade cnv operator

Returns: bool: if cnv operator is upgraded successfully

wait_for_the_resource_to_discover(kind, namespace, resource_name)

Waits for the specified resource to be discovered.

Parameters:
  • kind (str) – The type of the resource to wait for.

  • namespace (str) – The namespace in which to wait for the resource.

  • resource_name (str) – The name of the resource to wait for.

ocs_ci.deployment.deployment module

This module provides base class for different deployment platforms like AWS, VMWare, Baremetal etc.

class ocs_ci.deployment.deployment.Deployment

Bases: object

Base for all deployment platforms

class OCPDeployment

Bases: OCPDeployment

This class has to be implemented in child class and should overload methods for platform specific config.

acm_operator_installed()

Check if ACM HUB is already installed :returns: True if ACM HUB operator is installed, False otherwise :rtype: bool

add_node()

Implement platform-specific add_node in child class

cleanup_pgsql_db()

Perform cleanup for noobaa external pgsql DB in case external pgsq is enabled.

configure_acm_to_import_mce_clusters()

Configure ACM to import MCE operator cluster and hosted clusters

deploy_acm_hub()

Handle ACM HUB deployment

deploy_acm_hub_released()

Handle ACM HUB released image deployment

deploy_acm_hub_unreleased()

Handle ACM HUB unreleased image deployment

deploy_acm_hub_unreleased_konflux()

Handle ACM HUB unreleased image deployment for 2.14 and later version

deploy_cluster(log_cli_level='DEBUG')

We are handling both OCP and OCS deployment here based on flags

Parameters:

log_cli_level (str) – log level for installer (default: DEBUG)

deploy_gitops_operator(switch_ctx=None)

Deploy GitOps operator

Parameters:

switch_ctx (int) – The cluster index by the cluster name

deploy_lvmo()

deploy lvmo for platform specific (for now only vsphere)

deploy_multicluster_hub()

Handle Multicluster HUB creation :returns: True if ACM HUB is installed, False otherwise :rtype: bool

deploy_ocp(log_cli_level='DEBUG')

Base deployment steps, the rest should be implemented in the child class.

Parameters:

log_cli_level (str) – log level for installer (default: DEBUG)

deploy_ocs()

Handle OCS deployment, since OCS deployment steps are common to any platform, implementing OCS deployment here in base class.

deploy_ocs_via_operator(image=None)

Method for deploy OCS via OCS operator

Parameters:

image (str) – Image of ocs registry.

deploy_odf_addon()

This method deploy ODF addon.

deploy_with_external_mode()

This function handles the deployment of OCS on external/indpendent RHCS cluster

deployment_with_ui()

Deployment OCS Operator via OpenShift Console

destroy_cluster(log_level='DEBUG')

Base destroy cluster method, for more platform specific stuff please overload this method in child class.

Parameters:

log_level (str) – log level for installer (default: DEBUG)

do_deploy_cert_manager()

Installs cert-manager operator

do_deploy_cnv()

Deploy CNV We run it in OCP deployment stage, hence ship_ocs_deployment is set True. When we run it in OCS deployment stage, the skip_ocs_deployment is set to False automatically and second installation does not happen.

do_deploy_hosted_clusters()

Deploy Hosted cluster(s)

do_deploy_hyperconverged()

Deploy HyperConverged Operator and resources that works instead of CNV operator. Should run on OCP deployment phase

do_deploy_lvmo()

call lvm deploy

do_deploy_mce()

Deploy Multicluster Engine Shall run on OCP deployment phase

do_deploy_metallb()

Deploy MetalLB

do_deploy_oadp()

Deploy OADP Operator

do_deploy_ocp(log_cli_level)

Deploy OCP :param log_cli_level: log level for the installer :type log_cli_level: str

do_deploy_ocs()

Deploy OCS/ODF and run verification as well

do_deploy_odf_provider_mode()

Deploy ODF in provider mode and setup native client

do_deploy_rdr()

Call Regional DR deploy

do_deploy_submariner()

Deploy Submariner operator

do_gitops_deploy()

Deploy GitOps operator

Returns:

external_post_deploy_validation()

This function validates successful deployment of OCS in external mode, some of the steps overlaps with converged mode

get_arbiter_location()

Get arbiter mon location for storage cluster

get_rdr_conf()

Aggregate important Regional DR parameters in the dictionary

Returns:

of Regional DR config parameters

Return type:

dict

label_and_taint_nodes()

Label and taint worker nodes to be used by OCS operator

muliclusterhub_running()

Check if MultiCluster Hub is running

Returns:

True if MultiCluster Hub is running, False otherwise

Return type:

bool

objectstore_user_check()
odf_deployments_check()

Check on existance of deployments inspired by upstream check: https://github.com/red-hat-storage/odf-operator/blob/main/hack/install-odf.sh#L34-L44

patch_default_sc_to_non_default()

Patch storage class which comes as default with installation to non-default

post_ocp_deploy()

Function does post OCP deployment stuff we need to do.

set_noobaa_core_for_rgw_ssl()

Set env variables for noobaa-core StatefulSet to inject SSL environment variables required for RGW SSL connections in external mode to W/A issue: https://issues.redhat.com/browse/DFBUGS-3777#

This adds NODE_OPTIONS and SSL_CERT_FILE environment variables to the noobaa-core container to enable SSL certificate validation.

subscribe_ocs()

This method subscription manifest and subscribe to OCS operator.

wait_for_csv(csv_name, namespace=None)

Wait for the CSV to appear

Parameters:
  • csv_name (str) – CSV name pattern

  • namespace (str) – Namespace where CSV exists

wait_for_subscription(subscription_name, namespace=None)

Wait for the subscription to appear

Parameters:
  • subscription_name (str) – Subscription name pattern

  • namespace (str) – Namespace name for checking subscription if None then default from ENV_DATA

class ocs_ci.deployment.deployment.MDRMultiClusterDROperatorsDeploy(dr_conf)

Bases: MultiClusterDROperatorsDeploy

A class for Metro-DR deployments

deploy()

deploy ODF multicluster orchestrator operator

deploy_dr_policy()

Deploy dr policy with MDR perspective, only on active ACM

deploy_multicluster_orchestrator()
class ocs_ci.deployment.deployment.MultiClusterDROperatorsDeploy(dr_conf)

Bases: object

Implement Multicluster DR operators deploy part here, mainly 1. ODF Multicluster Orchestrator operator 2. Metadata object stores (s3 OR MCG) 3. ODF Hub operator 4. ODF Cluster operator

add_cacert_ramen_configmap()

Add CaCert to Ramen hub ConfigMap

backup_pod_status_check()
build_bucket_name(acm_indexes)

Create backupname from cluster names :param acm_indexes: List of acm indexes :type acm_indexes: list

configure_mirror_peer()
create_dpa(bucket_name)

create DPA OADP will be already installed when we enable backup flag Here we will create dataprotection application and update bucket name and s3 storage link :param bucket_name: Name of the Bucket :type bucket_name: str

create_generic_credentials(access_key, secret_key, acm_indexes)

Create s3 secret for backup and restore :param access_key: S3 access key :type access_key: str :param secret_key: S3 secret key :type secret_key: str :param acm_indexes: List of acm indexes :type acm_indexes: list

create_s3_bucket(access_key, secret_key, bucket_name)

Create s3 bucket :param access_key: S3 access key :type access_key: str :param secret_key: S3 secret key :type secret_key: str :param acm_indexes: List of acm indexes :type acm_indexes: list

deploy()

deploy ODF multicluster orchestrator operator

deploy_dr_multicluster_orchestrator()

Deploy multicluster orchestrator

deploy_dr_policy()
enable_cluster_backup()

set cluster-backup to True in mch resource Note: changing this flag automatically installs OADP operator

enable_managed_serviceaccount()

update MultiClusterEngine

class mcg_meta_obj_store

Bases: object

class s3_meta_obj_store(conf=None)

Bases: object

Internal class to handle aws s3 metadata obj store

deploy_and_configure()
get_meta_access_secret_keys()

Get aws_access_key_id and aws_secret_access_key by default we go with AWS, in case of noobaa it should be implemented in mcg_meta_obj_store class

get_participating_regions()

Get all the participating regions in the DR scenario

Returns:

List of participating regions

Return type:

list of str

get_ramen_resource()
get_s3_profiles()

Get names of s3 profiles from hub configmap resource

get_s3_secret_names()

Get secret resource names for s3

s3_configure()
update_config_map_commit(config_map_data, prefix=None)

merge the config and update the resource

Parameters:
  • config_map_data (dict) – base dictionary which will be later converted to yaml content

  • prefix (str) – Used to identify temp yaml

update_ramen_config_misc()
validate_dpa()

Validate 1. 3 restic / Node-agent pods 2. 1 velero pod 3. backupstoragelocation resource in “Available” phase

validate_mirror_peer(resource_name)

Validate mirror peer, Begins with CTX: ACM

  1. Check phase: if RDR then state = ‘ExchangedSecret’

    if MDR then state = ‘S3ProfileSynced’

  2. Check token-exchange-agent pod in ‘Running’ phase

Raises:

ResourceWrongStatusException – If pod is not in expected state

validate_policy_compliance_status(resource_name, resource_namespace, compliance_state)

Validate policy status for given resource

Returns: True if compliance check passes else raises ResourceWrongStatusException when resource state does not match

validate_secret_creation_oadp()

Verify Secret are created

Raises:

ResourceNotFoundError – raised when secret not found

verify_dr_hub_operator()
class ocs_ci.deployment.deployment.RBDDRDeployOps

Bases: object

All RBD specific DR deployment operations

configure_rbd()
deploy()
validate_csi_sidecar()

validate sidecar containers for rbd mirroring on each of the ODF cluster

validate_mirror_peer(resource_name)

Validate mirror peer, Begins with CTX: ACM

  1. Check initial phase of ‘ExchangingSecret’

  2. Check token-exchange-agent pod in ‘Running’ phase

Raises:

ResourceWrongStatusException – If pod is not in expected state

class ocs_ci.deployment.deployment.RDRMultiClusterDROperatorsDeploy(dr_conf)

Bases: MultiClusterDROperatorsDeploy

A class for Regional-DR deployments

check_observability_status()

Check observability status

Raises:

ACMObservabilityNotEnabled – if the cmd returns False, ACM observability is not enabled

deploy()

RDR specific steps for deploy

enable_acm_observability()

Function to enable ACM observability for enabling DR monitoring dashboard for Regional DR on the RHACM console.

thanos_secret()

Create thanos secret yaml by using Noobaa or AWS bucket (AWS bucket is used in this function)

ocs_ci.deployment.deployment.create_catalog_source(image=None, ignore_upgrade=False)

This prepare catalog source manifest for deploy OCS operator from quay registry.

Parameters:
  • image (str) – Image of ocs registry.

  • ignore_upgrade (bool) – Ignore upgrade parameter.

ocs_ci.deployment.deployment.create_ocs_secret(namespace)

Function for creation of pull secret for OCS. (Mostly for ibmcloud purpose)

Parameters:

namespace (str) – namespace where to create the secret

ocs_ci.deployment.deployment.get_multicluster_dr_deployment()
ocs_ci.deployment.deployment.setup_persistent_monitoring()

Change monitoring backend to OCS. See the procedure at: https://docs.redhat.com/en/documentation/red_hat_openshift_data_foundation /4.16/html-single/managing_and_allocating_storage_resources/

ocs_ci.deployment.deployment.validate_acm_hub_install()

Verify the ACM MultiClusterHub installation was successful.

ocs_ci.deployment.disconnected module

This module contains functionality required for disconnected installation.

ocs_ci.deployment.disconnected.get_csv_from_image(bundle_image)

Extract clusterserviceversion.yaml file from operator bundle image.

Parameters:

bundle_image (str) – OCS operator bundle image

Returns:

loaded yaml from CSV file

Return type:

dict

ocs_ci.deployment.disconnected.mirror_images_from_mapping_file(mapping_file, idms=None, ignore_image=None)

Mirror images based on mapping.txt file.

Parameters:
  • mapping_file (str) – path to mapping.txt file

  • idms (dict) – ImageDigestMirrorSet used for mirroring (workaround for stage images, which are pointing to different registry than they really are)

  • ignore_image – image which should be ignored when applying idms (mirrored index image)

ocs_ci.deployment.disconnected.mirror_index_image_via_oc_mirror(index_image, packages, idms=None)

Mirror all images required for ODF deployment and testing to mirror registry via oc-mirror tool and create relevant imageContentSourcePolicy/imageDigestMirrorSet. https://github.com/openshift/oc-mirror

Parameters:
  • index_image (str) – index image which will be pruned and mirrored

  • packages (list) – list of packages to keep

  • idms (dict) – ImageDigestMirrorSet used for mirroring (workaround for stage images, which are pointing to different registry than they really are)

Returns:

mirrored index image

Return type:

str

ocs_ci.deployment.disconnected.mirror_ocp_release_images(ocp_image_path, ocp_version)

Mirror OCP release images to mirror registry.

Parameters:
  • ocp_image_path (str) – OCP release image path

  • ocp_version (str) – OCP release image version or checksum (starting with sha256:)

Returns:

tuple with four strings:
  • mirrored image path,

  • tag or checksum

  • imageContentSources (for install-config.yaml)

  • ImageDigestMirrorSet (for running cluster)

Return type:

tuple (str, str, str, str)

ocs_ci.deployment.disconnected.prepare_disconnected_ocs_deployment(upgrade=False)

Prepare disconnected ocs deployment: - mirror required images from redhat-operators - get related images from OCS operator bundle csv - mirror related images to mirror registry - create imageContentSourcePolicy for the mirrored images - disable the default OperatorSources

Parameters:

upgrade (bool) – is this fresh installation or upgrade process (default: False)

Returns:

mirrored OCS registry image prepared for disconnected installation

or None (for live deployment)

Return type:

str

ocs_ci.deployment.disconnected.prune_and_mirror_index_image(index_image, mirrored_index_image, packages, idms=None)

Prune given index image and push it to mirror registry, mirror all related images to mirror registry and create relevant imageContentSourcePolicy This uses opm index prune command, which supports only sqlite-based catalogs (<= OCP 4.10), for >= OCP 4.11 use oc-mirror tool implemented in mirror_index_image_via_oc_mirror(…) function.

Parameters:
  • index_image (str) – index image which will be pruned and mirrored

  • mirrored_index_image (str) – mirrored index image which will be pushed to mirror registry

  • packages (list) – list of packages to keep

  • idms (dict) – ImageDigestMirrorSet used for mirroring (workaround for stage images, which are pointing to different registry than they really are)

Returns:

path to generated catalogSource.yaml file

Return type:

str

ocs_ci.deployment.encryption module

This module provides functions for encryption configuration during deployment

ocs_ci.deployment.encryption.add_encryption_details_to_cluster_data(cluster_data)

Update storage cluster YAML data with encryption information from configuration.

Parameters:

cluster_data (dict) – storage cluster YAML data

Returns:

updated storage storage cluster yaml

Return type:

dict

ocs_ci.deployment.encryption.add_in_transit_encryption_to_cluster_data(cluster_data)

Update storage cluster YAML data with in-transit encryption configuration if required.

Parameters:

cluster_data (dict) – storage cluster YAML data

Returns:

updated storage storage cluster yaml

Return type:

dict

ocs_ci.deployment.factory module

class ocs_ci.deployment.factory.DeploymentFactory

Bases: object

A factory class to get specific platform object

get_deployment()

Get the exact deployment class based on ENV_DATA Example: deployment_platform may look like ‘aws’, ‘vmware’, ‘baremetal’ deployment_type may be like ‘ipi’, ‘upi’ or ‘ai’

ocs_ci.deployment.flexy module

All the flexy related classes and functionality lives here

class ocs_ci.deployment.flexy.FlexyAWSUPI

Bases: FlexyBase

A specific implementation of AWS UPI installation using flexy

class ocs_ci.deployment.flexy.FlexyBaremetalPSI

Bases: FlexyBase

A specific implementation of Baremetal with PSI using flexy

class ocs_ci.deployment.flexy.FlexyBase

Bases: object

A base class for all types of flexy installs

build_container_args(purpose='')

Builds most commonly used arguments for flexy container

Parameters:

purpose (str) – purpose for which we are building these args eg: destroy, debug. By default it will be empty string which turns into ‘deploy’ mode for flexy

Returns:

of flexy container args

Return type:

list

build_destroy_cmd()

Build flexy command line for ‘destroy’ operation

build_install_cmd()

Build flexy command line for ‘deploy’ operation

clone_and_unlock_ocs_private_conf()

Clone ocs_private_conf (flexy env and config) repo into flexy_host_dir

deploy(log_level='')

build and invoke flexy deployer here

Parameters:

log_level (str) – log level for flexy container

deploy_prereq()

Common flexy prerequisites like cloning the private-conf repo locally and updating the contents with user supplied values

destroy()

Invokes flexy container with ‘destroy’ argument

flexy_backup_work_dir()

Perform copying of flexy-dir to cluster_path.

flexy_post_processing()

Perform a few actions required after flexy execution: - update global pull-secret - login to mirror registry (disconnected cluster) - configure proxy server (disconnected cluster) - configure ntp (if required)

flexy_prepare_work_dir()
Prepare Flexy working directory (flexy-dir):
  • copy flexy-dir from cluster_path to data dir (if available)

  • set proper ownership

get_installer_payload(version=None)

A proper installer payload url required for flexy based on DEPLOYMENT[‘installer_version’]. If ‘nigtly’ is present then we will use registry.svc to get latest nightly else if ‘-ga’ is present then we will look for ENV_DATA[‘installer_payload_image’]

merge_flexy_env()

Update the Flexy env file with the user supplied values. This function assumes that the flexy_env_file is available (e.g. flexy-ocs-private repo has been already cloned).

run_container(cmd_string)

Actual container run happens here, a thread will be spawned to asynchronously print flexy container logs

Parameters:

cmd_string (str) – Podman command line along with options

class ocs_ci.deployment.flexy.FlexyVSPHEREUPI

Bases: FlexyBase

A specific implementation of vSphere UPI installation using flexy

ocs_ci.deployment.fusion module

This module contains functions needed to install IBM Fusion

class ocs_ci.deployment.fusion.FusionDeployment

Bases: object

create_catalog_source()

Create Fusion CatalogSource

create_namespace_and_operator_group()

Create Fusion Namespace and OperatorGroup

create_spectrum_fusion_cr()

Create SpectrumFusion CR.

create_subscription()

Create Fusion Subscription

deploy()

Install IBM Fusion Operator

get_installed_version()

Retrieve the installed Fusion version.

Returns:

Installed Fusion version.

Return type:

str

verify(sleep=30)

Verify the Fusion deployment was successful.

Parameters:

sleep (int, optional) – Seconds to wait before checking status. Defaults to 30.

ocs_ci.deployment.fusion.spectrum_fusion_status_check()

Ensure SpectrumFusion is in the Completed state.

Raises:
  • AssertionError – If SpectrumFusion is not in a completed state.

  • KeyError – If the status isn’t present in the SpectrumFusion data.

ocs_ci.deployment.fusion.wait_for_csv(csv_name, namespace)

Wait for the CSV to appear.

Parameters:
  • csv_name (str) – Name of CSV

  • namespace (str) – Namespace where CSV exists

ocs_ci.deployment.fusion.wait_for_subscription(subscription_name, namespace)

Wait for the subscription to appear.

Parameters:
  • subscription_name (str) – Name of Subscription

  • namespace (str) – Namespace where Subscription exists

ocs_ci.deployment.fusion_aas module

This module contains platform specific methods and classes for deployment on Fusion aaS

class ocs_ci.deployment.fusion_aas.FUSIONAAS

Bases: ROSA

Deployment class for Fusion aaS.

OCPDeployment

alias of FUSIONAASOCP

deploy_ocp(log_cli_level='DEBUG')

Deployment specific to OCP cluster on a cloud platform.

Parameters:

log_cli_level (str) – openshift installer’s log level (default: “DEBUG”)

deploy_ocs()

Deployment of ODF Managed Service addon on Fusion aaS.

destroy_ocs()

Uninstall ODF Managed Service addon via rosa cli.

class ocs_ci.deployment.fusion_aas.FUSIONAASOCP

Bases: ROSAOCP

Fusion aaS deployment class.

deploy(log_level='')

Deployment specific to OCP cluster on a Fusion aaS platform.

Parameters:

log_level (str) – openshift installer’s log level that is expected from inherited class

ocs_ci.deployment.fusion_data_foundation module

This module contains functions needed to install IBM Fusion Data Foundation.

class ocs_ci.deployment.fusion_data_foundation.FusionDataFoundationDeployment

Bases: object

create_fdf_service_cr()

Create Fusion Data Foundation Service CR.

create_image_digest_mirror_set()

Create or update ImageTagMirrorSet.

create_image_tag_mirror_set()

Create or update ImageTagMirrorSet.

static create_odfcluster()

Create OdfCluster CR

deploy()

Installs IBM Fusion Data Foundation.

get_installed_version()

Retrieve the installed FDF version.

Returns:

Installed FDF version.

Return type:

str

patch_catalogsource()

Patch the isf-data-foundation-catalog in order to ensure it is prioritized over redhat-operators.

setup_fdf_pre_release_deployment()

Perform steps to prepare for a Pre-release deployment of FDF.

setup_storage()

Setup storage

verify_fdf_installation()

Verify the FDF installation was successful.

class ocs_ci.deployment.fusion_data_foundation.FusionServiceInstance(resource_name='', *args, **kwargs)

Bases: OCP

class ocs_ci.deployment.fusion_data_foundation.OdfCluster(resource_name='', *args, **kwargs)

Bases: OCP

ocs_ci.deployment.fusion_data_foundation.add_storage_label()

Add storage label on worker nodes.

ocs_ci.deployment.fusion_data_foundation.extract_image_digest_mirror_set()

Extract the ImageDigestMirrorSet from the FDF build.

Returns:

Name of the extracted ImageDigestMirrorSet

Return type:

str

ocs_ci.deployment.fusion_data_foundation.fusion_service_instance_health_check()

Ensure the FusionServiceInstance is in the Healthy state.

Raises:
  • AssertionError – If the FusionServiceInstance is not in a completed state.

  • KeyError – If the health status isn’t present in the FusionServiceInstance data.

ocs_ci.deployment.fusion_data_foundation.odfcluster_status_check()

Ensure the OdfCluster is in a Ready state.

Raises:
  • AssertionError – If the OdfCluster is not in a completed state.

  • KeyError – If the status phase isn’t present in the OdfCluster data.

ocs_ci.deployment.fusion_data_foundation.run_patch_cmd(cmd)

Wrapper for run_cmd so we can retry if an CommandFailed is encountered

ocs_ci.deployment.fusion_data_foundation.storagecluster_health_check()

Ensure the StorageCluster (Ceph backend) is healthy and resilient.

Raises:
  • AssertionError – If the StorageCluster is not in a Ready state or Ceph health is not HEALTH_OK.

  • KeyError – If expected status keys are missing.

ocs_ci.deployment.gcp module

This module contains platform specific methods and classes for deployment on Google Cloud Platform (aka GCP).

class ocs_ci.deployment.gcp.GCPIPI

Bases: GCPBase

A class to handle GCP IPI specific deployment

OCPDeployment

alias of IPIOCPDeployment

ocs_ci.deployment.hosted_cluster module

class ocs_ci.deployment.hosted_cluster.HostedClients

Bases: HyperShiftBase

The class is intended to deploy multiple hosted OCP clusters on Provider platform and setup ODF client on them. All functions are for multiple clusters deployment or the helper functions. All functions related to OCP deployment or ODF client setup are in the respective classes.

check_odf_prerequisites()

Check prerequisites for ODF installation and Client cluster connection

config_has_hosted_odf_image(cluster_name)

Check if the config has hosted ODF image set for the cluster

Parameters:

cluster_name

Returns:

True if the config has hosted ODF image, False otherwise

Return type:

bool

deploy_hosted_ocp_clusters(cluster_names_list=None)

Deploy multiple hosted OCP clusters on Provider platform

Parameters:

cluster_names_list (list) – List of cluster names to deploy. If not provided, all clusters in config.ENV_DATA[“clusters”] will be deployed (optional argument)

Returns:

The list of cluster names for all hosted OCP clusters deployed by the func successfully

Return type:

list

deploy_multiple_odf_clients()

Deploy multiple ODF clients on hosted OCP clusters. Method tries to deploy ODF client on all hosted OCP clusters If ODF was already deployed on some of the clusters, it will be skipped for those clusters.

do_deploy(cluster_names=None)

Deploy multiple hosted OCP clusters on Provider platform and setup ODF client on them Perform the 7 stages of deployment: 1. Deploy multiple hosted OCP clusters 2. Download kubeconfig files 3. Verify OCP clusters are ready 4. Deploy ODF on all hosted clusters if version set in ENV_DATA 5. Verify ODF client is installed on all hosted clusters if deployed 6. Setup storage client on all hosted clusters if ENV_DATA.clusters.<cluster_name> has setup_storage_client:true 7. Verify all hosted clusters are ready and print kubeconfig paths to the console

If the CNV, OCP versions are unreleased we can not use that with released upstream MCE which is a component of Openshift Virtualization operator, MCE will be always behind failing the cluster creation. solution: disable MCE and install upstream Hypershift on the cluster

! Important ! due to n-1 logic we are assuming that desired CNV version <= OCP version of managing/Provider cluster

Parameters:

cluster_names (list) – cluster names to deploy, if None, all clusters from ENV_DATA will be deployed

Returns:

the list of HostedODF objects for all hosted OCP clusters deployed by the method successfully

Return type:

list

download_hosted_clusters_kubeconfig_files(cluster_names_paths_dict=None)

Get HyperShift hosted cluster kubeconfig for multiple clusters. Provided cluster_names_paths_dict will always be a default source of cluster names and paths

Parameters:
  • cluster_names_paths_dict (dict) – Optional argument. The function will download all kubeconfigs

  • configuration (to the folders specified in the) –

  • kubeconfig (or download a specific cluster's) –

  • argument. (to the folder provided as an) –

Returns:

the list of hosted cluster kubeconfig paths

Return type:

list

get_kubeconfig_path(cluster_name)

Get the kubeconfig path for the cluster

Parameters:

cluster_name (str) – Name of the cluster

Returns:

Path to the kubeconfig file

Return type:

str

storage_installation_requested(cluster_name)

Check if the storage client installation was requested in the config

Parameters:

cluster_name (str) – Name of the cluster

Returns:

True if the storage client installation was requested, False otherwise

Return type:

bool

verify_client_cluster_storage(cluster_name)

Verify storage connectivity for a single cluster by checking storage class existence

Parameters:

cluster_name (str) – Name of the cluster to verify

Returns:

True if storage classes exist and are properly configured, False otherwise

Return type:

bool

verify_hosted_ocp_clusters_from_provider()

Verify multiple HyperShift hosted clusters from provider. If cluster_names is not provided at ENV_DATA, it will get the list of hosted clusters from the provider to verify them all

Returns:

True if all hosted clusters passed verification, False otherwise

Return type:

bool

class ocs_ci.deployment.hosted_cluster.HostedODF(name: str)

Bases: HypershiftHostedOCP

apply_network_policy()

Apply network policy to the client namespace. Network policy is created always on Provider side.

Returns:

True if network policy is created or existed before, False otherwise

Return type:

bool

catalog_source_exists(*args, **kwargs)
create_catalog_source(*args, **kwargs)

Create catalog source for MetalLB

Arg:

metallb_version (str): MetalLB version

Returns:

True if catalog source is created, False otherwise, error if not get Ready state

Return type:

bool

create_ns(*args, **kwargs)
create_operator_group(*args, **kwargs)

Creates operator group for hyperconverged resources

create_storage_claim_cephfs(*args, **kwargs)
create_storage_claim_rbd(*args, **kwargs)
create_storage_client(*args, **kwargs)
create_subscription(*args, **kwargs)

Creates subscription for hyperconverged operator

csi_pods_exist()

Check if the CSI pods exist

Returns:

True if the CSI pods exist, False otherwise

Return type:

bool

do_deploy(*args, **kwargs)
enable_client_console_plugin(*args, **kwargs)
exec_oc_cmd(*args, **kwargs)
get_onboarding_key()

Get onboarding key using the private key from the secret

Returns:

onboarding token key

Return type:

str

get_onboarding_key_ui()

Get onboarding key from UI

Returns:

onboarding key from Provider UI

Return type:

str

get_provider_address()

Get the provider address

get_storage_client_status(*args, **kwargs)
network_policy_exists(namespace)

Check if the network policy is created

Returns:

True if the network policy exists, False otherwise

Return type:

bool

odf_client_installed(*args, **kwargs)
odf_csv_installed()

Check if ODF CSV is installed at client’s namespace

Returns:

True if ODF CSV is installed, False otherwise

Return type:

bool

operator_group_exists(*args, **kwargs)
setup_storage_client(*args, **kwargs)
setup_storage_client_converged(storage_consumer_name)

Setup storage client for converged cluster

Returns:

True if storage client is setup, False otherwise

Return type:

bool

storage_claim_exists_cephfs(*args, **kwargs)
storage_claim_exists_rbd(*args, **kwargs)
storage_class_exists(*args, **kwargs)
storage_client_exists(*args, **kwargs)
subscription_exists(*args, **kwargs)
wait_console_plugin_pod_running(*args, **kwargs)
wait_storage_claim_cephfs()

Wait for storage class claim for CephFS to be created

Returns:

True if storage class claim for CephFS is created, False otherwise

Return type:

bool

wait_storage_claim_rbd()

Wait for storage class claim for RBD to be created

Returns:

True if storage class claim for RBD is created, False otherwise

Return type:

bool

class ocs_ci.deployment.hosted_cluster.HypershiftHostedOCP(name)

Bases: HyperShiftBase, MetalLBInstaller, CNVInstaller, Deployment, MCEInstaller, HyperConverged

deploy_dependencies(deploy_acm_hub, deploy_cnv, deploy_metallb, download_hcp_binary, deploy_mce, deploy_hyperconverged)

Deploy dependencies for hosted OCP cluster :param deploy_acm_hub: bool Deploy ACM Hub :param deploy_cnv: bool Deploy CNV :param deploy_metallb: bool Deploy MetalLB :param download_hcp_binary: bool Download HCP binary :param deploy_mce: bool Deploy mce :param deploy_hyperconverged: bool Deploy Hyperconverged

deploy_ocp(**kwargs) str

Deploy hosted OCP cluster on provisioned Provider platform

Parameters:

**kwargs – Additional arguments for create_kubevirt_ocp_cluster (currently not in use)

Returns:

Name of the hosted cluster

Return type:

str

ocs_ci.deployment.hosted_cluster.apply_cluster_roles_wa(cluster_names)
ocs_ci.deployment.hosted_cluster.apply_hosted_cluster_mirrors_max_items_wa()

Apply workaround for MCE mirrors max items issue. This workaround is needed to avoid the error: “The number of items in the mirrors list exceeds the maximum allowed limit of 25”

ocs_ci.deployment.hosted_cluster.apply_hosted_control_plane_mirrors_max_items_wa()

Apply workaround for Hosted Control Plane mirrors max items issue. This workaround is needed to avoid the error: “The number of items in the mirrors list exceeds the maximum allowed limit of 25”

ocs_ci.deployment.hosted_cluster.create_agent_service_config()

Create AgentServiceConfig resource

ocs_ci.deployment.hosted_cluster.create_host_inventory()

Create InfraEnv resource for host inventory

ocs_ci.deployment.hosted_cluster.get_autodistributed_storage_classes()

Get the list of StorageClasses that were provisioned by ODF and should be auto-distributed

Returns:

List of StorageClass names that were provisioned by ODF

Return type:

list

ocs_ci.deployment.hosted_cluster.get_autodistributed_volume_snapshot_classes()

Get the list of VolumeSnapshotClasses that were provisioned by ODF and should be auto-distributed upon client connection

Returns:

List of VolumeSnapshotClass names that were provisioned by ODF

Return type:

list

ocs_ci.deployment.hosted_cluster.get_onboarding_token_from_secret(secret_name)

Get onboarding token from the secret

Parameters:

secret_name (str) – Name of the secret

Returns:

Onboarding token

Return type:

str

ocs_ci.deployment.hosted_cluster.hypershift_cluster_factory(cluster_names=None, ocp_version=None, odf_version=None, setup_storage_client=None, nodepool_replicas=None, duty='')

Factory function to create or use existing HyperShift clusters.

Parameters:
  • cluster_names (list) – List of cluster names. Only for duty==”create_hosted_cluster_push_config”

  • ocp_version (str) – OCP version. Only for duty==”create_hosted_cluster_push_config”

  • odf_version (str) – ODF version. Only for duty==”create_hosted_cluster_push_config”

  • setup_storage_client (bool) – Optional. Setup storage client. Only for duty==”create_hosted_cluster_push_config”

  • nodepool_replicas (int) – Nodepool replicas; supported values are 2,3.

  • duty=="create_hosted_cluster_push_config" (Only for) –

  • duty (str) – Duty to perform; “create_hosted_cluster_push_config” (for creation of hypershift cluster) or “use_existing_hosted_clusters_force_push_configs” (for pushing config even if config exists) or “use_existing_hosted_clusters_push_missing_configs” (for adding only missing configs)

ocs_ci.deployment.hosted_cluster.verify_backing_ceph_storage_for_clients()

Verify that backing Ceph storage classes exist on the Provider cluster

Returns:

True if all checks passed, False otherwise

Return type:

bool

ocs_ci.deployment.hyperconverged module

class ocs_ci.deployment.hyperconverged.HyperConverged

Bases: object

This class represent HyperConverged and contains all related methods we need to do with it. Hyperconverged Operator is used instead of unreleased CNV, to overcome catalogsource limitations on Client clusters

create_catalog_source()

Creates catalog source for hyperconverged resources ! No customization by purpose. Will always align with branch default image that is set in the default config.

create_hyperconverged_instance()

Create Hyperconverged instance

create_hyperconverged_namespace()

Creates the namespace for hyperconverged resources

create_operator_group()

Creates operator group for hyperconverged resources

create_subscription()

Creates subscription for hyperconverged operator

deploy_hyperconverged()

Deploy Hyperconverged Operator and resources

ocs_ci.deployment.hyperconverged.get_hyperconverged_corresponding_version(ocp_version: str) str

Given an OCP version, return the corresponding Hyperconverged version.

Rule: - Hyperconverged Major = OCP Major - 3 - Hyperconverged Minor = OCP Minor - 4

Parameters:

ocp_version – OCP version as a string (e.g., “4.18” or “4.18.3”)

Returns:

Corresponding Hyperconverged version as a string (e.g., “1.14”)

ocs_ci.deployment.hyperconverged.get_ocp_corresponding_version(hyperconverged_version: str) str

Given a Hyperconverged version, return the corresponding OCP version.

Rule: - OCP Major = Hyperconverged Major + 3 - OCP Minor = Hyperconverged Minor + 4

Parameters:

hyperconverged_version – Hyperconverged version as a string (e.g., “1.14”)

Returns:

Corresponding OCP version as a string (e.g., “4.18”)

ocs_ci.deployment.ibm module

This module implements the OCS deployment for IBM Power platform Base code in deployment.py contains the required changes to keep code duplication to minimum. Only destroy_ocs is retained here.

class ocs_ci.deployment.ibm.IBMDeployment

Bases: Deployment

Implementation of Deploy for IBM Power architecture

destroy_lso()
destroy_ocs()

Handle OCS destruction. Remove storage classes, PVCs, Storage Cluster, Openshift-storage namespace, LocalVolume, unlabel worker-storage nodes, delete ocs CRDs, etc.

ocs_ci.deployment.ibmcloud module

This module contains platform specific methods and classes for deployment on IBM Cloud Platform.

class ocs_ci.deployment.ibmcloud.IBMCloud

Bases: CloudDeploymentBase

Deployment class for IBM Cloud

OCPDeployment

alias of IBMCloudOCPDeployment

check_cluster_existence(cluster_name_prefix)

Check cluster existence based on a cluster name prefix.

Parameters:

cluster_name_prefix (str) – name prefix which identifies a cluster

Returns:

True if a cluster with the same name prefix already exists,

False otherwise

Return type:

bool

deploy_ocp(log_cli_level='DEBUG')

Deployment specific to OCP cluster on a cloud platform.

Parameters:

log_cli_level (str) – openshift installer’s log level (default: “DEBUG”)

class ocs_ci.deployment.ibmcloud.IBMCloudIPI

Bases: CloudDeploymentBase

A class to handle IBM Cloud IPI specific deployment

OCPDeployment

alias of IPIOCPDeployment

static check_cluster_existence(cluster_name_prefix)

Check cluster existence based on a cluster name prefix.

Parameters:

cluster_name_prefix (str) – name prefix which identifies a cluster

Returns:

True if a cluster with the same name prefix already exists,

False otherwise

Return type:

bool

delete_bucket()

Deletes the COS bucket

delete_leftover_resources(resource_group)

Delete leftovers from IBM Cloud.

Parameters:

resource_group (str) – Resource group in IBM Cloud that contains the cluster resources.

Raises:

LeftoversExistError – In case the leftovers after attempt to clean them out.

delete_resource_group(resource_group)

Delete the resource group that contained the cluster assets.

Parameters:

resource_group (str) – Resource group in IBM Cloud that contains the cluster resources.

delete_volumes(resource_group)

Delete the pvc volumes created in IBM Cloud that the openshift installer doesn’t remove.

Parameters:

resource_group (str) – Resource group in IBM Cloud that contains the cluster resources.

deploy_ocp(log_cli_level='DEBUG')

Perform IBMCloudIPI OCP deployment.

Parameters:

log_cli_level (str) – log level for installer (default: DEBUG)

destroy_cluster(log_level='DEBUG')

Destroy the OCP cluster.

Parameters:

log_level (str) – log level openshift-installer (default: DEBUG)

static export_api_key()

Exports the IBM CLoud API key as an environment variable.

get_load_balancers()

Gets the load balancers

Returns:

load balancers in json format

Return type:

json

get_load_balancers_count(region=None)

Gets the number of load balancers

Parameters:

region (str) – region (e.g. us-south), if not defined it will take from config.

Returns:

number of load balancers

Return type:

int

get_resource_group(return_id=False)

Retrieve and set the resource group being utilized for the cluster assets.

Parameters:

return_id (bool) – If True, it will return ID instead of name.

Returns:

name or ID of resource group if found. None: in case no RG found.

Return type:

str

manually_create_iam_for_vpc()

Manually specify the IAM secrets for the cloud provider

prepare_custom_vpc_and_network()

Prepare resource group, VPC, address prefixes, subnets, public gateways and attach subnets to public gateways. All for using custom VPC for IBM Cloud IPI deployment described here: https://docs.openshift.com/container-platform/4.15/installing/installing_ibm_cloud_public/installing-ibm-cloud-vpc.html

ocs_ci.deployment.ingress_node_firewall module

class ocs_ci.deployment.ingress_node_firewall.IngressNodeFirewallInstaller

Bases: object

IngressNodeFirewall Installer class for Ingress Node Firewall deployment

check_existing_packagemanifests()

Check if Ingress Node Firewall Operator is available or not.

Returns:

True if Ingress Node Operator is available, False otherwise

Return type:

bool

create_config()

Creates configuration for IngressNodeFirewall

create_namespace()

Creates the namespace for IngressNodeFirewall resources

Raises:

CommandFailed – If the ‘oc create’ command fails.

create_operatorgroup()

Creates an OperatorGroup for IngressNodeFirewall

create_rules(rules)

Create IngressNodeFirewall Rules

Parameters:

rules (dict) – dictionary of IngressNodeFirewall Rules (content of spec.ingress)

create_subscription()

Creates subscription for IngressNodeFirewall operator

verify_csv_status()

Verify the CSV status for the IngressNodeFirewall Operator deployment equals Succeeded

ocs_ci.deployment.ingress_node_firewall.deploy_ingress_node_firewall(rules)

Deploy Ingress Node Firewall Operator used for example for restricting SSH access to nodes

Parameters:

rules (dict) – dictionary of IngressNodeFirewall Rules (content of spec.ingress)

ocs_ci.deployment.ingress_node_firewall.restrict_ssh_access_to_nodes()

Deploy IngressNodeFirewall and configure rules to restrict SSH access to nodes

ocs_ci.deployment.install_ocp_on_rhel module

This module will install OCP on RHEL nodes

class ocs_ci.deployment.install_ocp_on_rhel.OCPINSTALLRHEL(rhel_worker_nodes)

Bases: object

Class to install OCP on RHEL nodes

create_inventory()

Creates the inventory file

Returns:

Path to inventory file

Return type:

str

create_inventory_for_haproxy()

Creates the inventory file for haproxy

Returns:

Path to inventory file for haproxy

Return type:

str

execute_ansible_playbook()

Run ansible-playbook on pod

prepare_rhel_nodes()

Prepare RHEL nodes for OCP installation

upload_helpers(ocp_repo)

Upload helper files to pod for OCP installation on RHEL Helper Files:

- ssh_key pem
- ocp repo
- ocp pem
- kubeconfig
- pull secret
- inventory yaml
Parameters:

ocp_repo (str) – OCP repo to upload

ocs_ci.deployment.mce module

This module contains functionality required for mce installation.

class ocs_ci.deployment.mce.MCEInstaller

Bases: object

mce Installer class for mce deployment

check_hypershift_namespace()

Check hypershift namespace created

check_supported_versions()

Check supported ocp versions for hcp cluster creation

create_image_override()

Create hypershift image override cm

create_mce_namespace()

Creates the namespace for mce resources

Raises:

CommandFailed – If the ‘oc create’ command fails.

create_mce_subscription()

Creates subscription for mce operator

create_multiclusterengine_operatorgroup()

Creates multiclusterengine operator group

create_multiclusterengine_resource()

Creates multiclusterengine resource

deploy_mce()

Installs mce enabling software emulation.

get_supported_versions()

Get supported versions from the supported-versions configmap.

Returns:

Supported versions string or empty string if command fails.

Return type:

str

mce_exists()

Check if MCE exists

Returns:

True if MCE exists, False otherwise

Return type:

bool

mce_installed()

Check if MCE is already installed.

Returns:

True if MCE is installed, False otherwise

Return type:

bool

wait_mce_resources()

Wait for mce Available state and deployments Ready state

Raises:

TimeoutExpiredError – If the deployment is not in the ‘Available’ state within the timeout

ocs_ci.deployment.metallb module

class ocs_ci.deployment.metallb.MetalLBInstaller(namespace: str = 'metallb-system')

Bases: object

apply_icsp()

Apply the ICSP to the cluster

apply_idms()

Apply the IDMS to the cluster

catalog_source_created()

Check if catalog source is created

Returns:

True if catalog source is created, False otherwise

Return type:

bool

create_catalog_source(metallb_version=None)

Create catalog source for MetalLB

Arg:

metallb_version (str): MetalLB version

Returns:

True if catalog source is created, False otherwise, error if not get Ready state

Return type:

bool

create_ip_address_pool()

Create IP address pool for MetalLB

Returns:

True if IP address pool is created, False if creation failed

Return type:

bool

Raises:
  • NotImplementedError – if platform is not supported

  • ValueError – if number of reserved IP addresses for MetalLB is not specified

create_l2advertisement()

Create L2 advertisement for IP address pool

Returns:

True if L2 advertisement is created, False if failed, None if L2 advertisement already exists

Return type:

bool

create_metallb_instance()

Create MetalLB instance :returns: True if MetalLB instance is created, False/None otherwise :rtype: bool

create_metallb_namespace()

Create MetalLB namespace :returns: True if namespace is created, False otherwise :rtype: bool

create_metallb_operator_group()

Create MetalLB operator group

Returns:

True if operator group is created, False otherwise

Return type:

bool

create_metallb_subscription()

Create MetalLB subscription

Returns:

True if subscription is created, and metallb pods are Ready, False otherwise

Return type:

bool

delete_catalogsource()

Delete catalog source

Returns:

True if catalog source is deleted, False otherwise

Return type:

bool

delete_ipaddresspool()

Delete ipaddresspool

Returns:

True if ipaddresspool is deleted, False otherwise

Return type:

bool

delete_l2advertisement()

Delete l2advertisement

Returns:

True if l2advertisement is deleted, False otherwise

Return type:

bool

delete_metallb_namespace()

Delete MetalLB namespace

Returns:

True if namespace is deleted, False otherwise

delete_operatorgroup()

Delete operator group

Returns:

True if operator group is deleted, False otherwise

Return type:

bool

delete_subscription()

Delete subscription

Returns:

True if subscription is deleted, False otherwise

Return type:

bool

deploy_lb()

Deploy MetalLB If resources are already created, method will not create them again

Returns:

True if MetalLB is deployed, False otherwise

Return type:

bool

get_running_metallb_version()

Get the currently deployed cnv version

Returns:

metalLB version

Return type:

string

idms_brew_registry_exists()

Check if the IDMS Brew registry exists

Returns:

True if the IDMS Brew registry exists, False otherwise

Return type:

bool

ip_address_pool_created()

Check if IP address pool is created

Returns:

True if IP address pool is created, False otherwise

Return type:

bool

l2advertisement_created()

Check if L2 advertisement is created :returns: True if L2 advertisement is created, False otherwise :rtype: bool

metallb_instance_created()

Check if MetalLB instance is created

Returns:

True if MetalLB instance is created, False otherwise

Return type:

bool

metallb_kind_available()

Check if MetalLB Kind is available This method is a hack to avoid ‘Error is error: the server doesn’t have a resource type “MetalLB”’ or time.sleep

Returns:

True if MetalLB Kind is available, False otherwise

Return type:

bool

metallb_operator_group_created()

Check if MetalLB operator group is created

Returns:

True if operator group is created, False otherwise

Return type:

bool

metallb_patch_subscription(patch)

Update the subscription with patch information

Parameters:

patch (dict) – patch information

subscription_created()

Check if subscription already exists :returns: True if subscription already exists, False otherwise :rtype: bool

undeploy()

Undeploy MetalLB

update_ip_address_pool_cr(ipaddresspool_data)

Update IP address pool custom resource

Parameters:

ipaddresspool_data (dict) – IP address pool data. YAML accessible as dict

upgrade_metallb()

Upgrade metalLB operator

Returns:

if metallb operator is upgraded successfully

Return type:

bool

wait_csv_installed()

Verify if MetalLB CSV is installed

Returns:

True if MetalLB CSV is installed, False otherwise

Return type:

bool

ocs_ci.deployment.multicluster_deployment module

class ocs_ci.deployment.multicluster_deployment.OCPDeployWithACM

Bases: Deployment

When we instantiate this class, the assumption is we already have an OCP cluster with ACM installed and current context is ACM

deploy_cluster(log_cli_level='INFO')

We deploy new OCP clusters using ACM Note: Importing cluster through ACM has been implemented as part of Jenkins pipeline

destroy_cluster(log_cli_level=None)

Teardown OCP clusters deployed through ACM

do_deploy_ocp(log_cli_level='INFO')

This function overrides the parent’s function in order accomodate ACM based OCP cluster deployments

do_rdr_acm_ocp_deploy()

Specific to regional DR OCP cluster deployments

post_deploy_ops()
  1. Install ingress certificates on OCP clusters deployed through ACM

  2. Run post_ocp_deploy on OCP clusters

post_destroy_ops(cluster_list)

Post destroy ops mainly includes ip clean up and dns cleanup

Parameters:

cluster_list (list[ACMOCPClusterDeploy]) – list of platform specific instances

wait_for_all_cluster_async_destroy(destroy_cluster_list)
wait_for_all_clusters_async()

ocs_ci.deployment.netsplit module

ocs_ci.deployment.netsplit.get_netsplit_mc(tmp_path, master_zones, worker_zones, enable_split=True, x_addr_list=None, arbiter_zone=None, latency=None)

Generate machineconfig with network split scripts and configuration, tailored for the current cluster state.

Parameters:
  • tmp_path (pathlib.Path) – Directory where a temporary yaml file will be created. In test context, use pytest fixture tmp_path.

  • master_zones (list[str]) – zones where master nodes are placed

  • worker_zones (list[str]) – zones where worker nodes are placed

  • x_addr_list (list[str]) – IP addressess of external services (zone x)

  • arbiter_zone (str) – name of arbiter zone if arbiter deployment is used

  • latency (int) – additional latency in miliseconds, which will be introduced among zones

Returns:

mc (dict with MachineConfig) to deploy via

deploy_machineconfig()

Raises:
  • UnexpectedDeploymentConfiguration – in case of invalid cluster configuration, which prevents deployment of network split scripts

  • ValueError – in case given zone configuration doesn’t make any sense

ocs_ci.deployment.nmstate module

class ocs_ci.deployment.nmstate.NMStateInstaller

Bases: object

NMState Installer class for NMState deployment

count_nmstate_pods_running(count)

Count the pods for NMState Operator are running

Return type:

bool

create_nmstate_instance()

Create an instance of the nmstate Operator

create_nmstate_operator_namespace()

Creates the namespace for NMState resources

Raises:

CommandFailed – If the ‘oc create’ command fails.

create_nmstate_operatorgroup()

Creates an OperatorGroup for NMState

create_nmstate_subscription()

Creates subscription for NMState operator

running_nmstate()

Install NMState operator and create an instance

verify_nmstate_csv_status()

Verify the CSV status for the nmstate Operator deployment equals Succeeded

verify_nmstate_pods_running()

Verify the pods for NMState Operator are running

ocs_ci.deployment.ocp module

This module provides base class for OCP deployment.

class ocs_ci.deployment.ocp.OCPDeployment

Bases: object

create_config()

Create the OCP deploy config, if something needs to be changed for specific platform you can overload this method in child class.

deploy(log_cli_level='DEBUG')

Implement ocp deploy in specific child class

deploy_prereq()

Perform generic prereq before calling openshift-installer This method performs all the basic steps necessary before invoking the installer

destroy(log_level='DEBUG')

Destroy OCP cluster specific

Parameters:

log_level (str) – log level openshift-installer (default: DEBUG)

download_installer()

Method to download installer

Returns:

path to the installer

Return type:

str

get_pull_secret()

Load pull secret file

Returns:

content of pull secret

Return type:

str

get_ssh_key()

Loads public ssh to be used for deployment

Returns:

public ssh key or empty string if not found

Return type:

str

test_cluster()

Test if OCP cluster installed successfuly

ocs_ci.deployment.ocp.download_pull_secret()

Download the pull secret from the cluster and store it locally.

Returns:

pull secret path

Return type:

str

ocs_ci.deployment.on_prem module

This module contains common code and a base class for any on-premise platform deployment.

class ocs_ci.deployment.on_prem.IPIOCPDeployment

Bases: OCPDeployment

Common implementation of IPI OCP deployments for on-premise platforms

deploy(log_cli_level='DEBUG')

Deployment specific to OCP cluster for on-prem platform

Parameters:

log_cli_level (str) – openshift installer’s log level (default: “DEBUG”)

deploy_prereq()

Overriding deploy_prereq from parent. Perform all necessary prerequisites for on-premise IPI here

class ocs_ci.deployment.on_prem.OnPremDeploymentBase

Bases: Deployment

Base class for deployment in on-premise platforms

check_cluster_existence(cluster_name_prefix)

Check cluster existence according to cluster name prefix

Returns:

True if a cluster with the same name prefix already exists,

False otherwise

Return type:

bool

deploy_ocp(log_cli_level='DEBUG')

Deployment specific to OCP cluster in on-premise platform

Parameters:

log_cli_level (str) – openshift installer’s log level (default: “DEBUG”)

ocs_ci.deployment.openshift_dedicated module

This module contains platform specific methods and classes for deployment on Openshfit Dedicated Platform.

class ocs_ci.deployment.openshift_dedicated.OpenshiftDedicated

Bases: CloudDeploymentBase

Deployment class for Openshift Dedicated.

OCPDeployment

alias of OpenshiftDedicatedOCP

check_cluster_existence(cluster_name_prefix)

Check cluster existence based on a cluster name.

Parameters:

cluster_name_prefix (str) – name prefix which identifies a cluster

Returns:

True if a cluster with the same name prefix already exists,

False otherwise

Return type:

bool

deploy_ocp(log_cli_level='DEBUG')

Deployment specific to OCP cluster on a cloud platform.

Parameters:

log_cli_level (str) – openshift installer’s log level (default: “DEBUG”)

class ocs_ci.deployment.openshift_dedicated.OpenshiftDedicatedOCP

Bases: OCPDeployment

Openshift Dedicated deployment class.

deploy(log_level='')

Deployment specific to OCP cluster on a cloud platform.

Parameters:

log_cli_level (str) – openshift installer’s log level

deploy_prereq()

Overriding deploy_prereq from parent. Perform all necessary prerequisites for Openshfit Dedciated deployment.

destroy(log_level='DEBUG')

Destroy OCP cluster specific

Parameters:

log_level (str) – log level openshift-installer (default: DEBUG)

ocs_ci.deployment.qe_app_registry module

class ocs_ci.deployment.qe_app_registry.QeAppRegistry

Bases: object

catalog_source()

Make sure the Catalog source from QE App registry exists on the cluster.

icsp()

Make sure the required ICSP is applied on the cluster

icsp_brew_registry_exists()

Check if the ICSP Brew registry exists

Returns:

True if the ICSP Brew registry exists, False otherwise

Return type:

bool

ocs_ci.deployment.rhv module

This module contains platform specific methods and classes for deployment on Red Hat Virtualization (RHV) platform

class ocs_ci.deployment.rhv.RHVIPI

Bases: RHVBASE

A class to handle RHV IPI specific deployment

OCPDeployment

alias of IPIOCPDeployment

ocs_ci.deployment.rosa module

This module contains platform specific methods and classes for deployment on Openshfit Dedicated Platform.

class ocs_ci.deployment.rosa.ROSA

Bases: CloudDeploymentBase

Deployment class for ROSA and ROSA HCP.

OCPDeployment

alias of ROSAOCP

check_cluster_existence(cluster_name_prefix)

Check cluster existence based on a cluster name. Cluster in Uninstalling phase is not considered to be existing

Parameters:

cluster_name_prefix (str) – name prefix which identifies a cluster

Returns:

True if a cluster with the same name prefix already exists,

False otherwise

Return type:

bool

deploy_ocp(log_cli_level='DEBUG')

Deployment specific to OCP cluster on a cloud platform.

Parameters:

log_cli_level (str) – openshift installer’s log level (default: “DEBUG”)

deploy_ocs()

Deployment of ODF Managed Service addon on ROSA or ODF operator on ROSA HCP.

destroy_ocs()

Uninstall ODF Managed Service addon via rosa cli.

host_network_update()

Update security group rules for HostNetwork

class ocs_ci.deployment.rosa.ROSAOCP

Bases: OCPDeployment

ROSA deployment class.

cluster_present()

Check if the cluster is present in the cluster list, regardless of its state.

Returns:

True if a cluster with the given name exists, False otherwise

Return type:

bool

deploy(log_level='')

Deployment specific to OCP cluster on a ROSA Managed Service platform.

Parameters:

log_level (str) – openshift installer’s log level

deploy_prereq()

Overriding deploy_prereq from parent. Perform all necessary prerequisites for Openshfit Dedciated deployment.

destroy(log_level='DEBUG')

Destroy OCP cluster specific

Parameters:

log_level (str) – log level openshift-installer (default: DEBUG)

ocs_ci.deployment.terraform module

This module contains terraform specific methods and classes needed for deployment on vSphere platform

class ocs_ci.deployment.terraform.Terraform(path, bin_path=None, state_file_path=None)

Bases: object

Wrapper for terraform

apply(tfvars, bootstrap_complete=False, module=None, refresh=True)

Apply the changes required to reach the desired state of the configuration

Parameters:
  • tfvars (str) – path to terraform.tfvars file

  • bootstrap_complete (bool) – Removes bootstrap node if True

  • module (str) – Module to apply e.g: constants.COMPUTE_MODULE

  • refresh (bool) – If True, updates the state for each resource prior to planning and applying

change_statefile(module, vm_index)

Remove the records from the state file so that terraform will no longer be tracking the corresponding remote objects.

Note: terraform state file should be present in the directory from where the commands are initiated

Parameters:
  • module (str) – Name of the module e.g: compute_vm, module.control_plane_vm etc.

  • vm_index (int) – VM index. If the VM is compute-1, index is 1 and if the VM is compute-2, then index is 2

Examples:

terraform = Terraform(os.path.join(upi_repo_path, "upi/vsphere/"))
terraform.change_statefile(
    module="compute_vm", vm_index=2
)
destroy(tfvars, refresh=True)

Destroys the cluster

Parameters:

tfvars (str) – path to terraform.tfvars file

destroy_module(tfvars, module)

Destroys the particular module/node

Parameters:
  • tfvars (str) – path to terraform.tfvars file

  • module (str) – Module to destroy e.g: constants.BOOTSTRAP_MODULE

static get_terraform_version()
initialize(upgrade=False)

Initialize a working directory containing Terraform configuration files

Parameters:

upgrade (bool) – True in case installing modules needs upgrade from previously-downloaded objects, False otherwise

output(tfstate, module, json_format=True)

Extracts the value of an output variable from the state file

Parameters:
  • tfstate (str) – path to terraform.tfstate file

  • module (str) – module to extract

  • json_format (bool) – True if format output as json

Returns:

output from tfstate

Return type:

str

ocs_ci.deployment.vmware module

This module contains platform specific methods and classes for deployment on vSphere platform

class ocs_ci.deployment.vmware.VSPHEREAI

Bases: VSPHEREBASE

A class to handle vSphere Assisted Installer specific deployment

class OCPDeployment

Bases: OCPDeployment

assign_api_ingress_ips()

Request API and Ingress IPs from IPAM server

create_config()

Creates the OCP deploy config for the vSphere - not required for Assisted installer deployment

deploy(log_cli_level='DEBUG')

Deployment specific to OCP cluster on this platform

Parameters:

log_cli_level (str) – not used for Assisted Installer deployment

deploy_prereq()

Pre-Requisites for vSphere Assisted installer deployment

generate_terraform_vars()

Generates the terraform.tfvars.json file

deploy_ocp(log_cli_level='DEBUG')

Deployment specific to OCP cluster on vSphere platform

Parameters:

log_cli_level (str) – openshift installer’s log level (default: “DEBUG”)

destroy_cluster(log_level='DEBUG')

Destroy OCP cluster specific to vSphere Assisted installer

Parameters:

log_level (str) – this parameter is not used here

class ocs_ci.deployment.vmware.VSPHEREIPI

Bases: VSPHEREBASE

A class to handle vSphere IPI specific deployment

class OCPDeployment

Bases: OCPDeployment

create_config()

Creates the OCP deploy config for the vSphere

deploy(log_cli_level='DEBUG')

Deployment specific to OCP cluster on this platform

Parameters:

log_cli_level (str) – openshift installer’s log level (default: “DEBUG”)

deploy_prereq()

Overriding deploy_prereq from parent. Perform all necessary prerequisites for VSPHEREIPI here.

deploy_ocp(log_cli_level='DEBUG')

Deployment specific to OCP cluster on this platform

Parameters:

log_cli_level (str) – openshift installer’s log level (default: “DEBUG”)

destroy_cluster(log_level='DEBUG')

Destroy OCP cluster specific to vSphere IPI

Parameters:

log_level (str) – log level openshift-installer (default: DEBUG)

post_destroy_checks(template_folder)

Post destroy checks on vSphere IPI cluster

Parameters:

template_folder (str) – template folder for the cluster

class ocs_ci.deployment.vmware.VSPHEREUPI

Bases: VSPHEREBASE

A class to handle vSphere UPI specific deployment

class OCPDeployment

Bases: OCPDeployment

change_ignition_ip_and_hostname(ip_address)

Embed into iso.ign ip address and hostname (sno-edge-0) :param ip_address: ip address we got from IPAM to embed inside iso” :type ip_address: str

configure_storage_for_image_registry(kubeconfig)

Configures storage for the image registry

create_config()

Creates the OCP deploy config for the vSphere

create_ignitions()

Creates the ignition files

create_sno_iso_and_upload()

Creating iso file with values for SNO deployment

deploy(log_cli_level='DEBUG')

Deployment specific to OCP cluster on this platform

Parameters:

log_cli_level (str) – openshift installer’s log level (default: “DEBUG”)

deploy_prereq()

Pre-Requisites for vSphere UPI Deployment

generate_manifests()

Generates manifest files

wait_for_sno_second_boot_change_ip_and_hostname(ip_address)

After second boot ocp is booting with the right ip address but after a while the ip is changed to dhcp. We monitor the ip address and when it changed we ssh to the node and change back the ip address and hostname :param ip_address: The ip address given from the IPAM server :type ip_address: str

Raises:

ConnectivityFail – Incase after the change we ping the ip_address. If it doesn’t reply we raise.

deploy_ocp(log_cli_level='DEBUG')

Deployment specific to OCP cluster on vSphere platform

Parameters:

log_cli_level (str) – openshift installer’s log level (default: “DEBUG”)

destroy_cluster(log_level='DEBUG')

Destroy OCP cluster specific to vSphere UPI

Parameters:

log_level (str) – log level openshift-installer (default: DEBUG)

destroy_scaleup_nodes(scale_up_terraform_data_dir, scale_up_terraform_var)

Destroy the scale-up nodes

Parameters:
  • scale_up_terraform_data_dir (str) – Path to scale-up terraform data directory

  • scale_up_terraform_var (str) – Path to scale-up terraform.tfvars file

ocs_ci.deployment.zones module

ocs_ci.deployment.zones.are_zone_labels_missing()

Check that there are no nodes with zone labels.

Returns:

True if all nodes are missing zone label, False otherwise.

Return type:

Bool

ocs_ci.deployment.zones.are_zone_labels_present()

Check that there are no nodes without zone labels.

Returns:

True if all nodes have a zone label, False otherwise.

Return type:

Bool

ocs_ci.deployment.zones.assign_dummy_zones(zones, nodes, overwrite=False)

Assign node labels to given nodes based on given zone lists. Zones are assigned so that there is the same number of nodes in each zone.

Parameters:
  • zones (list[str]) – list of k8s zone names

  • nodes (list[str]) – list of node names to label

  • overwrite (bool) – if True, labeling will not fail on already defined zone labels (False by default)

Raises:

ValueError – when number of nodes is not divisible by number of zones

ocs_ci.deployment.zones.create_dummy_zone_labels()

Create dummy zone labels on cluster nodes: try to label all master and worker nodes based on values of worker_availability_zones and master_availability_zones options, but only if there are no zone labels already defined.

Raises:

UnexpectedDeploymentConfiguration – when either cluster or ocs-ci config file are in conflict with dummy zone labels.

Module contents