ocs_ci.deployment package
Subpackages
- ocs_ci.deployment.helpers package
- Submodules
- ocs_ci.deployment.helpers.external_cluster_helpers module
ExternalClusterExternalCluster.create_object_store_user()ExternalCluster.enable_secure_connection_mode()ExternalCluster.get_admin_keyring()ExternalCluster.get_ceph_fs()ExternalCluster.get_external_cluster_details()ExternalCluster.get_object_store_user_secrets()ExternalCluster.get_rgw_endpoint_api_port()ExternalCluster.get_rhel_version()ExternalCluster.is_object_store_user_exists()ExternalCluster.is_rgw_user_exists()ExternalCluster.remove_rbd_images()ExternalCluster.remove_rgw_user()ExternalCluster.run_exporter_script()ExternalCluster.update_permission_caps()ExternalCluster.upload_exporter_script()ExternalCluster.upload_rgw_cert_ca()
generate_exporter_script()get_and_apply_rgw_cert_ca()get_external_cluster_client()get_node_by_role()get_rgw_endpoint()remove_csi_users()
- ocs_ci.deployment.helpers.hypershift_base module
HyperShiftBaseHyperShiftBase.create_kubevirt_ocp_cluster()HyperShiftBase.delete_hcp_and_hypershift()HyperShiftBase.delete_hcp_podman_container()HyperShiftBase.destroy_kubevirt_cluster()HyperShiftBase.download_hcp_binary_with_podman()HyperShiftBase.download_hosted_cluster_kubeconfig()HyperShiftBase.get_current_nodepool_size()HyperShiftBase.get_desired_nodepool_size()HyperShiftBase.get_hosted_cluster_kubeconfig_name()HyperShiftBase.get_hosted_cluster_progress()HyperShiftBase.get_hypershift_csv_version()HyperShiftBase.get_mce_version()HyperShiftBase.hcp_binary_exists()HyperShiftBase.hypershift_binary_exists()HyperShiftBase.hypershift_clusters_exist()HyperShiftBase.install_hcp_and_hypershift_from_git()HyperShiftBase.install_hypershift_upstream_on_cluster()HyperShiftBase.save_mirrors_list_to_file()HyperShiftBase.update_hcp_binary()HyperShiftBase.update_mirrors_list_to_file()HyperShiftBase.verify_hosted_ocp_cluster_from_provider()HyperShiftBase.wait_for_worker_nodes_to_be_ready()HyperShiftBase.wait_hosted_cluster_completed()HyperShiftBase.worker_nodes_deployed()
get_binary_hcp_version()get_hosted_cluster_names()kubeconfig_exists_decorator()
- ocs_ci.deployment.helpers.icsp_parser module
- ocs_ci.deployment.helpers.lso_helpers module
- ocs_ci.deployment.helpers.mcg_helpers module
- ocs_ci.deployment.helpers.odf_deployment_helpers module
- ocs_ci.deployment.helpers.prechecks module
- ocs_ci.deployment.helpers.rosa_prod_cluster_helpers module
- ocs_ci.deployment.helpers.vsphere_helpers module
- Module contents
Submodules
ocs_ci.deployment.acm module
All ACM related deployment classes and functions should go here.
- class ocs_ci.deployment.acm.Submariner
Bases:
objectSubmariner configuaration and deployment
- create_acm_brew_icsp()
This is a prereq for downstream unreleased submariner
- deploy()
- deploy_downstream()
- deploy_upstream()
- download_binary()
- download_downstream_binary()
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
- 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:
AWSBaseA 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:
AWSBaseA 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:
AZUREBaseA class to handle Azure IPI specific deployment.
- OCPDeployment
alias of
IPIOCPDeployment
ocs_ci.deployment.baremetal module
- class ocs_ci.deployment.baremetal.BAREMETALAI
Bases:
BAREMETALBASEA 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:
DeploymentA common class for Bare metal deployments
- class ocs_ci.deployment.baremetal.BAREMETALUPI
Bases:
BAREMETALBASEA 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:
DeploymentAll 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:
DeploymentBase 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:
OCPDeploymentCommon 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:
objectCNV Installer class for CNV deployment
- 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_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_virtctl_all_console_links()
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.
- get_virtctl_console_spec_links()
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. –
- 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:
objectBase for all deployment platforms
- CUSTOM_STORAGE_CLASS_PATH = None
filepath of yaml file with custom storage class if necessary
For some platforms, one have to create custom storage class for OCS to make sure ceph uses disks of expected type and parameters (eg. OCS requires ssd). This variable is either None (meaning that such custom storage class is not needed), or point to a yaml file with custom storage class.
- Type:
str
- DEFAULT_STORAGECLASS = None
- DEFAULT_STORAGECLASS_LSO = 'localblock'
- class OCPDeployment
Bases:
OCPDeploymentThis 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.
- 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_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_fusion()
Install IBM Fusion operator
- do_deploy_hosted_clusters()
Deploy Hosted cluster(s)
- do_deploy_lvmo()
call lvm deploy
- 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
- 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_rook_log_level()
- 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:
MultiClusterDROperatorsDeployA 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:
objectImplement 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
- 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:
objectInternal 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
- Check phase: if RDR then state = ‘ExchangedSecret’
if MDR then state = ‘S3ProfileSynced’
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
- Raises:
ResourceWrongStatusException – Raised 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:
objectAll 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
Check initial phase of ‘ExchangingSecret’
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:
MultiClusterDROperatorsDeployA 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_external_pgsql_secret()
Creates secret for external PgSQL to be used by Noobaa
- ocs_ci.deployment.deployment.create_fusion_catalog_source()
Create catalog source for fusion operator
- 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
- 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, icsp=None, ignore_image=None)
Mirror images based on mapping.txt file.
- Parameters:
mapping_file (str) – path to mapping.txt file
icsp (dict) – ImageContentSourcePolicy 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 icsp (mirrored index image)
- ocs_ci.deployment.disconnected.mirror_index_image_via_oc_mirror(index_image, packages, icsp=None)
Mirror all images required for ODF deployment and testing to mirror registry via oc-mirror tool and create relevant imageContentSourcePolicy. 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
icsp (dict) – ImageContentSourcePolicy 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)
ImageContentSourcePolicy (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, icsp=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
icsp (dict) – ImageContentSourcePolicy 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.factory module
- class ocs_ci.deployment.factory.DeploymentFactory
Bases:
objectA 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:
FlexyBaseA specific implementation of AWS UPI installation using flexy
- class ocs_ci.deployment.flexy.FlexyBaremetalPSI
Bases:
FlexyBaseA specific implementation of Baremetal with PSI using flexy
- class ocs_ci.deployment.flexy.FlexyBase
Bases:
objectA 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
ocs_ci.deployment.fusion module
This module contains functions needed to install IBM Fusion
- ocs_ci.deployment.fusion.deploy_fusion()
Installs IBM Fusion
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:
ROSADeployment 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.
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:
GCPBaseA class to handle GCP IPI specific deployment
- CUSTOM_STORAGE_CLASS_PATH = '/home/docs/checkouts/readthedocs.org/user_builds/ocs-ci/checkouts/release-4.16/ocs_ci/templates/ocs-deployment/storageclass.gcp.yaml'
filepath of yaml file with custom storage class if necessary
For some platforms, one have to create custom storage class for OCS to make sure ceph uses disks of expected type and parameters (eg. OCS requires ssd). This variable is either None (meaning that such custom storage class is not needed), or point to a yaml file with custom storage class.
- Type:
str
- OCPDeployment
alias of
IPIOCPDeployment
ocs_ci.deployment.hosted_cluster module
- class ocs_ci.deployment.hosted_cluster.HostedClients
Bases:
HyperShiftBaseThe 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.
- 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()
Deploy multiple hosted OCP clusters on Provider platform
- 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.
- Returns:
the list of kubeconfig paths for all hosted OCP clusters
- Return type:
list
- do_deploy()
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. Verify OCP clusters are ready 3. Download kubeconfig files 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
- download_hosted_clusters_kubeconfig_files()
Get HyperShift hosted cluster kubeconfig for multiple clusters :returns: the list of hosted cluster kubeconfig paths :rtype: list
- 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
- 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)
- create_storage_claim_cephfs(*args, **kwargs)
- create_storage_claim_rbd(*args, **kwargs)
- create_storage_client(*args, **kwargs)
- create_subscription(*args, **kwargs)
- 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)
- 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)
- 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_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- deploy_dependencies(deploy_acm_hub, deploy_cnv, deploy_metallb, download_hcp_binary)
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
- deploy_ocp(deploy_cnv=True, deploy_acm_hub=True, deploy_metallb=True, download_hcp_binary=True)
Deploy hosted OCP cluster on provisioned Provider platform
- Parameters:
deploy_cnv – (bool) Deploy CNV
deploy_acm_hub – (bool) Deploy ACM Hub
deploy_metallb – (bool) Deploy MetalLB
download_hcp_binary – (bool) Download HCP binary
- Returns:
Name of the hosted cluster
- Return type:
str
- 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.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:
DeploymentImplementation 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:
CloudDeploymentBaseDeployment class for IBM Cloud
- DEFAULT_STORAGECLASS = 'ibmc-vpc-block-10iops-tier'
- 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:
CloudDeploymentBaseA class to handle IBM Cloud IPI specific deployment
- DEFAULT_STORAGECLASS = 'ibmc-vpc-block-10iops-tier'
- 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_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:
objectIngressNodeFirewall Installer class for Ingress Node Firewall deployment
- 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:
objectClass 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.metallb module
- class ocs_ci.deployment.metallb.MetalLBInstaller(namespace: str = 'metallb-system')
Bases:
object- apply_icsp()
Apply the ICSP 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()
Create catalog source for MetalLB
- 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
- icsp_brew_registry_exists()
Check if the ICSP Brew registry exists
- Returns:
True if the ICSP 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
- 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
- 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:
DeploymentWhen 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()
Install ingress certificates on OCP clusters deployed through ACM
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:
objectNMState 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:
OCPDeploymentCommon 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:
DeploymentBase 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:
CloudDeploymentBaseDeployment 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:
OCPDeploymentOpenshift 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.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:
RHVBASEA 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:
CloudDeploymentBaseDeployment class for ROSA.
- 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.
- 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:
OCPDeploymentROSA deployment class.
- cluster_present(cluster_name)
Check if the cluster is present in the cluster list, regardless of its state.
- Parameters:
cluster_name (str) – name which identifies the cluster
- 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_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.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:
objectWrapper 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, resource_type, resource_name, instance)
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.
resource_type (str) – Resource type e.g: vsphere_virtual_machine, vsphere_compute_cluster etc.
resource_name (str) – Name of the resource e.g: vm
instance (str) – Name of the instance e.g: compute-0.j-056vu1cs33l-a.qe.rh-ocs.com
Examples:
terraform = Terraform(os.path.join(upi_repo_path, "upi/vsphere/")) terraform.change_statefile( module="compute_vm", resource_type="vsphere_virtual_machine", resource_name="vm", instance="compute-0.j-056vu1cs33l-a.qe.rh-ocs.com" )
- 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:
VSPHEREBASEA 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:
VSPHEREBASEA 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:
VSPHEREBASEA 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_zonesandmaster_availability_zonesoptions, 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.