From 8a56c567160a4957deedfb2b87ab39a0144c0096 Mon Sep 17 00:00:00 2001 From: Jiri Petrlik Date: Tue, 6 Feb 2024 15:56:58 +0100 Subject: [PATCH] RHOAIENG-23 - Cleanup CodeFlare installation code --- .../Files/codeflare_sub_template.yaml | 15 ----- .../Resources/RHODS_OLM/RHODS_OLM.resource | 2 - .../install/codeflare_install.resource | 53 ----------------- .../Resources/RHODS_OLM/install/install.robot | 4 -- .../RHODS_OLM/install/oc_install.robot | 4 -- .../pre-tasks/oc_is_operator_installed.robot | 12 ---- .../uninstall/codeflare_uninstall.resource | 58 ------------------- .../RHODS_OLM/uninstall/uninstall.robot | 6 -- ods_ci/tasks/Tasks/rhods_olm.robot | 3 - ods_ci/tests/Resources/Common.robot | 15 ----- .../test-run-dw-tests.robot | 1 - 11 files changed, 173 deletions(-) delete mode 100644 ods_ci/tasks/Resources/Files/codeflare_sub_template.yaml delete mode 100644 ods_ci/tasks/Resources/RHODS_OLM/install/codeflare_install.resource delete mode 100644 ods_ci/tasks/Resources/RHODS_OLM/uninstall/codeflare_uninstall.resource diff --git a/ods_ci/tasks/Resources/Files/codeflare_sub_template.yaml b/ods_ci/tasks/Resources/Files/codeflare_sub_template.yaml deleted file mode 100644 index c20238f3f..000000000 --- a/ods_ci/tasks/Resources/Files/codeflare_sub_template.yaml +++ /dev/null @@ -1,15 +0,0 @@ -kind: List -metadata: {} -apiVersion: v1 -items: - - apiVersion: operators.coreos.com/v1alpha1 - kind: Subscription - metadata: - name: rhods-codeflare-operator - namespace: openshift-operators - spec: - channel: - installPlanApproval: Automatic - name: rhods-codeflare-operator - source: - sourceNamespace: openshift-marketplace diff --git a/ods_ci/tasks/Resources/RHODS_OLM/RHODS_OLM.resource b/ods_ci/tasks/Resources/RHODS_OLM/RHODS_OLM.resource index c923c6b1a..20984524a 100644 --- a/ods_ci/tasks/Resources/RHODS_OLM/RHODS_OLM.resource +++ b/ods_ci/tasks/Resources/RHODS_OLM/RHODS_OLM.resource @@ -2,10 +2,8 @@ Resource config/cluster.robot Resource install/oc_install.robot Resource install/install.robot -Resource install/codeflare_install.resource Resource pre-tasks/oc_is_operator_installed.robot Resource uninstall/oc_uninstall.robot Resource uninstall/uninstall.robot -Resource uninstall/codeflare_uninstall.resource Resource upgrade/oc_upgrade.robot Resource upgrade/upgrade.robot diff --git a/ods_ci/tasks/Resources/RHODS_OLM/install/codeflare_install.resource b/ods_ci/tasks/Resources/RHODS_OLM/install/codeflare_install.resource deleted file mode 100644 index 5d09ab460..000000000 --- a/ods_ci/tasks/Resources/RHODS_OLM/install/codeflare_install.resource +++ /dev/null @@ -1,53 +0,0 @@ -*** Settings *** -Documentation RHODS CodeFlare operator installation keywords -Resource ../../../../tests/Resources/Common.robot -Resource ../install/oc_install.robot -Resource ../pre-tasks/oc_is_operator_installed.robot -Library String -Library OperatingSystem -Library OpenShiftLibrary - - -*** Keywords *** -Installing CodeFlare Operator - [Documentation] Installs the RHODS CodeFlare operator if it is not already installed - ${is_operator_installed} = Is CodeFlare Installed - IF not ${is_operator_installed} - Log Installing CodeFlare operator console=yes - Install CodeFlare ${cluster_type} - END - -CodeFlare Operator Should Be Installed - [Documentation] Verifies the RHODS CodeFlare operator installation and stores CodeFlare version - Verify CodeFlare Installation - ${version} = Get CodeFlare Version - Set Global Variable $CODEFLARE_VERSION ${version} - Log CodeFlare has been installed console=yes - -Install CodeFlare - [Documentation] Installs the RHODS CodeFlare operator, expects RHODS operator already installed - [Arguments] ${cluster_type} - ${file_path} = Set Variable tasks/Resources/Files/ - IF "${cluster_type}" == "managed" - ${catalog_source} = Set Variable "addon-managed-odh-catalog" - ELSE - ${catalog_source} = Set Variable "redhat-operators" - END - Copy File source=${file_path}codeflare_sub_template.yaml destination=${file_path}codeflare_sub_apply.yaml - Run sed -i 's//${CODEFLARE_UPDATE_CHANNEL}/' ${file_path}codeflare_sub_apply.yaml - Run sed -i 's//${catalog_source}/' ${file_path}codeflare_sub_apply.yaml - Oc Apply kind=List src=${file_path}codeflare_sub_apply.yaml - Remove File ${file_path}codeflare_sub_apply.yaml - -Verify CodeFlare Installation - [Documentation] Verifies the RHODS CodeFlare operator deployment existence - Log Verifying CodeFlare installation console=yes - Log To Console Waiting for CodeFlare resources to be up and running - Wait For Pods Numbers 1 - ... namespace=openshift-operators - ... label_selector=app.kubernetes.io/name=codeflare-operator - ... timeout=2000 - Wait For Pods Status namespace=openshift-operators - ... label_selector=app.kubernetes.io/name=codeflare-operator - ... timeout=1200 - Log Verified rhods-codeflare-operator console=yes diff --git a/ods_ci/tasks/Resources/RHODS_OLM/install/install.robot b/ods_ci/tasks/Resources/RHODS_OLM/install/install.robot index 8d8d328f9..565f46f27 100644 --- a/ods_ci/tasks/Resources/RHODS_OLM/install/install.robot +++ b/ods_ci/tasks/Resources/RHODS_OLM/install/install.robot @@ -2,7 +2,6 @@ Documentation RHODS operator installation top-level keywords Resource ../pre-tasks/oc_is_operator_installed.robot Resource oc_install.robot -Resource codeflare_install.resource *** Keywords *** @@ -13,9 +12,6 @@ Installing RHODS Operator ${image_url} ... Set Suite Variable ${image_url} AND ... Set Test Variable ${RHODS_OSD_INSTALL_REPO} AND ... Install RHODS ${cluster_type} ${image_url} - ${is_codeflare_managed} = Is CodeFlare Managed - Log Will install CodeFlare operator: ${is_codeflare_managed} console=yes - IF ${is_codeflare_managed} Installing CodeFlare Operator RHODS Operator Should Be installed Verify RHODS Installation diff --git a/ods_ci/tasks/Resources/RHODS_OLM/install/oc_install.robot b/ods_ci/tasks/Resources/RHODS_OLM/install/oc_install.robot index 84a89fefd..d12223afa 100644 --- a/ods_ci/tasks/Resources/RHODS_OLM/install/oc_install.robot +++ b/ods_ci/tasks/Resources/RHODS_OLM/install/oc_install.robot @@ -68,10 +68,6 @@ Verify RHODS Installation Log Verified redhat-ods-operator console=yes END - # The CodeFlare operator verification needs to happen after RHODS operator and before DataScienceCluster is created! - ${is_codeflare_managed} = Is CodeFlare Managed - Log Will verify CodeFlare operator: ${is_codeflare_managed} console=yes - IF ${is_codeflare_managed} CodeFlare Operator Should Be Installed IF "${UPDATE_CHANNEL}" == "odh-nightlies" or "${cluster_type}" != "managed" Apply DataScienceCluster CustomResource dsc_name=${DSC_NAME} END diff --git a/ods_ci/tasks/Resources/RHODS_OLM/pre-tasks/oc_is_operator_installed.robot b/ods_ci/tasks/Resources/RHODS_OLM/pre-tasks/oc_is_operator_installed.robot index ecf64327b..73ca5680b 100644 --- a/ods_ci/tasks/Resources/RHODS_OLM/pre-tasks/oc_is_operator_installed.robot +++ b/ods_ci/tasks/Resources/RHODS_OLM/pre-tasks/oc_is_operator_installed.robot @@ -77,15 +77,3 @@ Check A RHODS Family Operator Is Installed END Log Operator with sub ${subscription} is installed result: ${result} console=yes IF not ${result} FAIL The operator with sub ${subscription} is not installed. - -Is CodeFlare Installed - [Documentation] Returns if the RHODS CodeFlare operator is currently installed - ${result} = Run Keyword And Return Status - ... Check A RHODS Family Operator Is Installed namespace=openshift-operators subscription=rhods-codeflare-operator - Log RHODS CodeFlare is installed: ${result} console=yes - RETURN ${result} - -Is CodeFlare Managed - [Documentation] Returns if the RHODS CodeFlare operator should be installed/uninstalled alongside RHODS operator - ${isCodeFlareManaged} = Convert To Boolean ${MANAGE_CODEFLARE_OPERATOR} - RETURN ${isCodeFlareManaged} diff --git a/ods_ci/tasks/Resources/RHODS_OLM/uninstall/codeflare_uninstall.resource b/ods_ci/tasks/Resources/RHODS_OLM/uninstall/codeflare_uninstall.resource deleted file mode 100644 index ae3c17a3e..000000000 --- a/ods_ci/tasks/Resources/RHODS_OLM/uninstall/codeflare_uninstall.resource +++ /dev/null @@ -1,58 +0,0 @@ -*** Settings *** -Documentation RHODS CodeFlare operator uninstallation keywords -Resource ../install/oc_install.robot -Resource ../../../../tests/Resources/Common.robot -Resource ../../../../tests/Resources/Page/Operators/ISVs.resource -Resource oc_uninstall.robot - -Library Process - - -*** Keywords *** -Uninstalling CodeFlare Operator - [Documentation] Uninstalls the RHODS CodeFlare operator if it is installed - ${is_operator_installed} = Is CodeFlare Installed - IF ${is_operator_installed} - Log Uninstalling CodeFlare operator in ${cluster_type} console=yes - Uninstall CodeFlare - END - -Uninstall CodeFlare - [Documentation] Removes the RHODS CodeFlare operator subscription and CSV - # needs to be deleted first to avoid getting stuck on CodeFlare finalizer - ${return_code} ${output} Run And Return Rc And Output - ... oc delete mcads.codeflare.codeflare.dev mcad -n redhat-ods-applications --ignore-not-found - Should Be Equal As Integers ${return_code} 0 msg=Error deleting CodeFlare MCAD CR - Uninstall ISV Operator From OperatorHub Via CLI rhods-codeflare-operator openshift-operators - -CodeFlare Operator Should Be Uninstalled - [Documentation] Verifies and logs that the RHODS CodeFlare operator is uninstalled - Verify CodeFlare Uninstallation - Log CodeFlare has been uninstalled console=yes - -Verify CodeFlare Uninstallation - [Documentation] Verifies that the RHODS CodeFlare operator is uninstalled - Run Keyword And Expect Error *Not Found* - ... Oc Get kind=Subscription namespace=openshift-operators - ... label_selector=app.kubernetes.io/name=codeflare-operator - Verify Pod Does Not Exists app.kubernetes.io/name=codeflare-operator - -Verify Pod Does Not Exists - [Documentation] Verifies that a Pod with a label matching given selector does not exist - [Arguments] ${selector} - Log Checking pod with label selector: ${selector} - ${pod_exists} = Run Keyword and return status - ... Oc Get kind=Pod label_selector=${selector} - IF ${pod_exists} Wait Until Pod Is Deleted ${selector} 3600 - Log Pod with label ${selector} deleted console=yes - -Wait Until Pod Is Deleted - [Documentation] Waits until the pod with a label matching given selector is deleted - [Arguments] ${selector} ${timeout} - FOR ${counter} IN RANGE ${timeout} - ${pod_exists} = Run Keyword and return status - ... Oc Get kind=Pod label_selector=${selector} - Exit For Loop If not ${pod_exists} - END - IF ${pod_exists} - ... Fail Pod matching ${selector} has not been deleted after ${timeout} attempts! diff --git a/ods_ci/tasks/Resources/RHODS_OLM/uninstall/uninstall.robot b/ods_ci/tasks/Resources/RHODS_OLM/uninstall/uninstall.robot index d56da76a0..4b6d85657 100644 --- a/ods_ci/tasks/Resources/RHODS_OLM/uninstall/uninstall.robot +++ b/ods_ci/tasks/Resources/RHODS_OLM/uninstall/uninstall.robot @@ -3,15 +3,11 @@ Resource ../install/oc_install.robot Resource ../pre-tasks/oc_is_operator_installed.robot Resource ../../../../tests/Resources/Common.robot Resource oc_uninstall.robot -Resource codeflare_uninstall.resource Library Process *** Keywords *** Uninstalling RHODS Operator - ${is_codeflare_managed} = Is CodeFlare Managed - IF ${is_codeflare_managed} Uninstalling CodeFlare Operator - ${is_operator_installed} = Is RHODS Installed IF ${is_operator_installed} Run Keywords ... Log Uninstalling RHODS operator in ${cluster_type} console=yes AND ... Uninstall RHODS @@ -45,8 +41,6 @@ Uninstall RHODS In Self Managed Cluster END RHODS Operator Should Be Uninstalled - ${is_codeflare_managed} = Is CodeFlare Managed - IF ${is_codeflare_managed} CodeFlare Operator Should Be Uninstalled Verify RHODS Uninstallation Log RHODS has been uninstalled console=yes diff --git a/ods_ci/tasks/Tasks/rhods_olm.robot b/ods_ci/tasks/Tasks/rhods_olm.robot index 61e711c52..e3eb098a7 100644 --- a/ods_ci/tasks/Tasks/rhods_olm.robot +++ b/ods_ci/tasks/Tasks/rhods_olm.robot @@ -15,11 +15,8 @@ ${RHODS_OSD_INSTALL_REPO} None ${TEST_ENV} AWS ${INSTALL_TYPE} OperatorHub ${UPDATE_CHANNEL} odh-nightlies -${MANAGE_CODEFLARE_OPERATOR} False -${CODEFLARE_UPDATE_CHANNEL} odh-nightlies ${OLM_DIR} rhodsolm ${RHODS_VERSION} None -${CODEFLARE_VERSION} None *** Tasks *** Can Install RHODS Operator diff --git a/ods_ci/tests/Resources/Common.robot b/ods_ci/tests/Resources/Common.robot index a04afd611..d9d431b2f 100644 --- a/ods_ci/tests/Resources/Common.robot +++ b/ods_ci/tests/Resources/Common.robot @@ -125,21 +125,6 @@ Get RHODS Version Log Product:${PRODUCT} Version:${RHODS_VERSION} RETURN ${RHODS_VERSION} -#robocop: disable: line-too-long -Get CodeFlare Version - [Documentation] Return RHODS CodeFlare operator version number. - ... Will fetch version only if $CODEFLARE_VERSION was not already set, or $force_fetch is True. - [Arguments] ${force_fetch}=False - IF "${CODEFLARE_VERSION}" == "${None}" or "${force_fetch}" == "True" - IF "${PRODUCT}" == "${None}" or "${PRODUCT}" == "RHODS" - ${CODEFLARE_VERSION}= Run oc get csv -n openshift-operators | grep "rhods-codeflare-operator" | awk '{print $1}' | sed 's/rhods-codeflare-operator.//' - ELSE - ${CODEFLARE_VERSION}= Run oc get csv -n openshift-operators | grep "codeflare-operator" | awk -F ' {2,}' '{print $3}' - END - END - Log Product:${PRODUCT} CodeFlare Version:${CODEFLARE_VERSION} - RETURN ${CODEFLARE_VERSION} - Get Cluster ID [Documentation] Retrieves the ID of the currently connected cluster ${cluster_id}= Run oc get clusterversion -o json | jq .items[].spec.clusterID diff --git a/ods_ci/tests/Tests/650__distributed_workloads/test-run-dw-tests.robot b/ods_ci/tests/Tests/650__distributed_workloads/test-run-dw-tests.robot index d6a51f171..8a8d2de8d 100644 --- a/ods_ci/tests/Tests/650__distributed_workloads/test-run-dw-tests.robot +++ b/ods_ci/tests/Tests/650__distributed_workloads/test-run-dw-tests.robot @@ -1,7 +1,6 @@ *** Settings *** Documentation Distributed workloads tests -Resource ../../../tasks/Resources/RHODS_OLM/install/codeflare_install.resource Resource ../../../tasks/Resources/RHODS_OLM/install/oc_install.robot Resource ../../Resources/Page/DistributedWorkloads/DistributedWorkloads.resource