Skip to content

Commit

Permalink
Add support to uninstall odh-nightly from managed cluster (red-hat-d…
Browse files Browse the repository at this point in the history
…ata-services#1421)

Add support to uninstall odh-nightly from managed cluster
  • Loading branch information
tarukumar authored May 6, 2024
1 parent 3e55ab3 commit c2a17e0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,23 @@ Is RHODS Installed
FAIL Provided test environment and install type combination is not supported
END
ELSE IF "${cluster_type}" == "managed"
Set Global Variable ${SUB_NAME} addon-managed-odh
Set Global Variable ${CATALOG_NAME} addon-managed-odh-catalog
#For managed cluster
IF "${UPDATE_CHANNEL}" == "odh-nightlies"
Set Global Variable ${OPERATOR_NAMESPACE} openshift-marketplace
Set Global Variable ${SUB_NAME} rhoai-operator-dev
Set Global Variable ${CATALOG_NAME} rhoai-catalog-dev
END
${result}= Run Keyword And Return Status
... Run Keywords
... Check A RHODS Family Operator Is Installed namespace=${OPERATOR_NAMESPACE}
... subscription=addon-managed-odh AND
... subscription=${SUB_NAME} AND
... Oc Get kind=Namespace field_selector=metadata.name=${MONITORING_NAMESPACE} AND
... Oc Get kind=Namespace field_selector=metadata.name=${APPLICATIONS_NAMESPACE} AND
... Oc Get kind=Namespace field_selector=metadata.name=${OPERATOR_NAMESPACE} AND
... Oc Get kind=CatalogSource namespace=${OPERATOR_NAMESPACE}
... field_selector=metadata.name=addon-managed-odh-catalog
... field_selector=metadata.name=${CATALOG_NAME}
ELSE
FAIL Provided test environment and install type ${INSTALL_TYPE} ${UPDATE_CHANNEL} ${cluster_type} combination
... is not supported
Expand Down
7 changes: 5 additions & 2 deletions ods_ci/tasks/Resources/RHODS_OLM/uninstall/oc_uninstall.robot
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ Verify RHODS Uninstallation
IF "${cluster_type}" == "managed"
Run Keyword And Expect Error *Not Found*
... Oc Get kind=CatalogSource namespace=${OPERATOR_NAMESPACE}
... field_selector=metadata.name=addon-managed-odh-catalog
... field_selector=metadata.name=${CATALOG_NAME}
ELSE IF "${cluster_type}" == "selfmanaged"
Run Keyword And Expect Error *Not Found*
... Oc Get kind=CatalogSource namespace=openshift-marketplace
... field_selector=metadata.name=rhoai-catalog-dev
END
Verify Project Does Not Exists ${MONITORING_NAMESPACE}
Verify Project Does Not Exists ${APPLICATIONS_NAMESPACE}
Verify Project Does Not Exists ${OPERATOR_NAMESPACE}
IF "${OPERATOR_NAMESPACE}" != "openshift-marketplace"
Verify Project Does Not Exists ${OPERATOR_NAMESPACE}
END


Verify Project Does Not Exists
[Arguments] ${project}
Expand Down
18 changes: 15 additions & 3 deletions ods_ci/tasks/Resources/RHODS_OLM/uninstall/uninstall.robot
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,19 @@ Uninstall RHODS In Self Managed Cluster For Operatorhub

Uninstall RHODS V2
[Documentation] Keyword to uninstall the version 2 of the RHODS operator in Self-Managed
Log To Console message=Deleting DSC CR From Cluster
${return_code} ${output} Run And Return Rc And Output
... oc get DataScienceCluster --all-namespaces -o custom-columns=:metadata.name --ignore-not-found | xargs -I {} oc patch DataScienceCluster {} --type=merge -p '{"metadata": {"finalizers":null}}' || true #robocop:disable
${return_code} ${output} Run And Return Rc And Output
... oc delete datasciencecluster --all --ignore-not-found
Should Be Equal As Integers ${return_code} 0 msg=Error deleting DataScienceCluster CR
Log To Console message=Deleting DSCi CR From Cluster
${return_code} ${output} Run And Return Rc And Output
... oc get DSCInitialization --all-namespaces -o custom-columns=:metadata.name --ignore-not-found | xargs -I {} oc patch DSCInitialization {} --type=merge -p '{"metadata": {"finalizers":null}}' || true #robocop:disable
${return_code} ${output} Run And Return Rc And Output
... oc delete dscinitialization --all --ignore-not-found
Should Be Equal As Integers ${return_code} 0 msg=Error deleting DSCInitialization CR

Log To Console message=Deleting Operator Subscription From Cluster
${return_code} ${subscription_name} Run And Return Rc And Output
... oc get subscription -n ${OPERATOR_NAMESPACE} --no-headers | awk '{print $1}'
IF "${return_code}" == "0" and "${subscription_name}" != "${EMPTY}"
Expand All @@ -85,18 +91,24 @@ Uninstall RHODS V2
... oc delete subscription ${subscription_name} -n ${OPERATOR_NAMESPACE} --ignore-not-found
Should Be Equal As Integers ${return_code} 0 msg=Error deleting RHODS subscription
END
Log To Console message=Deleting Operator CSV From Cluster
${return_code} ${output} Run And Return Rc And Output
... oc delete clusterserviceversion opendatahub-operator.1.18.0 -n openshift-operators --ignore-not-found
Log To Console message=Deleting Operator Catalog From Cluster
${return_code} ${output} Run And Return Rc And Output
... oc delete CatalogSource rhoai-catalog-dev -n openshift-marketplace --ignore-not-found # robocop: disable
${return_code} ${output} Run And Return Rc And Output
... oc delete CatalogSource addon-managed-odh-catalog -n openshift-marketplace --ignore-not-found # robocop: disable
Log To Console message=Deleting Operator Group From Cluster
${return_code} ${output} Run And Return Rc And Output
... oc delete operatorgroup --all -n ${OPERATOR_NAMESPACE} --ignore-not-found
Should Be Equal As Integers ${return_code} 0 msg=Error deleting operatorgroup
Log To Console message=Deleting Operator and it's associate namepsace
${return_code} ${output} Run And Return Rc And Output oc delete ns -l opendatahub.io/generated-namespace --ignore-not-found
Verify Project Does Not Exists ${APPLICATIONS_NAMESPACE}
Verify Project Does Not Exists ${MONITORING_NAMESPACE}
Verify Project Does Not Exists ${NOTEBOOKS_NAMESPACE}
${return_code} ${output} Run And Return Rc And Output oc delete namespace ${OPERATOR_NAMESPACE} --ignore-not-found
Verify Project Does Not Exists ${OPERATOR_NAMESPACE}
IF "${OPERATOR_NAMESPACE}" != "openshift-marketplace"
${return_code} ${output} Run And Return Rc And Output oc delete namespace ${OPERATOR_NAMESPACE} --ignore-not-found
Verify Project Does Not Exists ${OPERATOR_NAMESPACE}
END

0 comments on commit c2a17e0

Please sign in to comment.