def wait_for_co(operator): """ Waits for ClusterOperator to created Args: operator (str): Name of the ClusterOperator """ from ocs_ci.ocs.ocp import OCP ocp = OCP(kind='ClusterOperator') ocp.get(operator)
def get_csi_versions(): """ Gets the CSI related version information Returns: dict: CSI related version information """ csi_versions = {} # importing here to avoid circular imports from ocs_ci.ocs.ocp import OCP ocp_pod_obj = OCP(kind=constants.POD, namespace=config.ENV_DATA['cluster_namespace']) csi_provisioners = [ 'csi-cephfsplugin-provisioner', 'csi-rbdplugin-provisioner' ] for provisioner in csi_provisioners: csi_provisioner_pod = run_cmd( f"oc -n {config.ENV_DATA['cluster_namespace']} get pod -l " f"'app={provisioner}' -o jsonpath='{{.items[0].metadata.name}}'") desc = ocp_pod_obj.get(csi_provisioner_pod) for container in desc['spec']['containers']: name = container['name'] version = container['image'].split("/")[-1].split(":")[1] csi_versions[name] = version return csi_versions
def get_cluster_version_info(): """ Gets the complete cluster version information Returns: dict: cluster version information """ # importing here to avoid circular imports from ocs_ci.ocs.ocp import OCP ocp = OCP(kind="clusterversion") cluster_version_info = ocp.get("version") return cluster_version_info