ocs_ci.deployment package¶
Submodules¶
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:
ocs_ci.deployment.aws.AWSBaseA class to handle AWS IPI specific deployment
-
OCPDeployment¶
-
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:
ocs_ci.deployment.aws.AWSBaseA class to handle AWS UPI specific deployment
-
class
OCPDeployment¶ Bases:
ocs_ci.deployment.ocp.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
- Raise:
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
-
class
ocs_ci.deployment.azure module¶
This module contains platform specific methods and classes for deployment on Azure platform.
ocs_ci.deployment.baremetal module¶
-
class
ocs_ci.deployment.baremetal.BAREMETALUPI¶ Bases:
ocs_ci.deployment.deployment.DeploymentA class to handle Bare metal UPI specific deployment
-
class
OCPDeployment¶ Bases:
ocs_ci.deployment.ocp.OCPDeployment-
check_bm_status_exist()¶ Check if BM Cluster already exist
- Returns
response status
- Return type
str
-
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)¶ 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
-
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
-
class
ocs_ci.deployment.baremetal.BaremetalPSIUPI¶ Bases:
ocs_ci.deployment.deployment.DeploymentAll the functionalities related to BaremetalPSI- UPI deployment lives here
-
class
OCPDeployment¶ Bases:
ocs_ci.deployment.ocp.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
-
-
class
-
ocs_ci.deployment.baremetal.clean_disk()¶ Perform disk cleanup
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:
ocs_ci.deployment.deployment.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:
ocs_ci.deployment.ocp.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.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:
ocs_ci.deployment.ocp.OCPDeploymentThis class has to be implemented in child class and should overload methods for platform specific config.
-
add_node()¶ Implement platform-specific add_node in child class
-
create_ocs_operator_source(image=None)¶ This prepare catalog or operator source for OCS deployment.
- Parameters
image (str) – Image of ocs registry.
-
create_stage_operator_source()¶ This prepare operator source for OCS deployment from stage.
-
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_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_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)
-
external_post_deploy_validation()¶ This function validates successful deployment of OCS in external mode, some of the steps overlaps with converged mode
-
label_and_taint_nodes()¶ Label and taint worker nodes to be used by OCS operator
-
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.
-
subscribe_ocs()¶ This method subscription manifest and subscribe to OCS operator.
-
-
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.link_all_sa_and_secret(secret_name, namespace)¶ Link all service accounts in specified namespace with the secret for pulling of images.
- Parameters
secret_name (str) – secret name
namespace (str) – namespace name
-
ocs_ci.deployment.deployment.link_sa_and_secret(sa_name, secret_name, namespace)¶ Link service account and secret for pulling of images.
- Parameters
sa_name (str) – service account name
secret_name (str) – secret name
namespace (str) – namespace name
-
ocs_ci.deployment.deployment.setup_persistent_monitoring()¶ Change monitoring backend to OCS
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.prepare_disconnected_ocs_deployment()¶ Prepare disconnected ocs deployment: - get related images from OCS operator bundle csv - mirror related images to mirror registry - create imageContentSourcePolicy for the mirrored images - disable the default OperatorSources
- Returns
- OCS registry image prepared for disconnected installation (with
sha256 digest) or None (for live deployment)
- Return type
str
ocs_ci.deployment.factory module¶
ocs_ci.deployment.flexy module¶
All the flexy related classes and functionality lives here
-
class
ocs_ci.deployment.flexy.FlexyAWSUPI¶ Bases:
ocs_ci.deployment.flexy.FlexyBaseA specific implementation of AWS UPI installation using flexy
-
class
ocs_ci.deployment.flexy.FlexyBaremetalPSI¶ Bases:
ocs_ci.deployment.flexy.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 (disconected 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.gcp module¶
This module contains platform specific methods and classes for deployment on Google Cloud Platform (aka GCP).
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:
ocs_ci.deployment.deployment.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:
ocs_ci.deployment.cloud.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”)
-
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.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
dict
-
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.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:
ocs_ci.deployment.cloud.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:
ocs_ci.deployment.ocp.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.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)¶ Bases:
objectWrapper for terraform
-
apply(tfvars, bootstrap_complete=False, module=None)¶ 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
-
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
-
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.VSPHEREUPI¶ Bases:
ocs_ci.deployment.vmware.VSPHEREBASEA class to handle vSphere UPI specific deployment
-
class
OCPDeployment¶ Bases:
ocs_ci.deployment.ocp.OCPDeployment-
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
-
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
-
-
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
-
class