Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to uninstall odh-nightly from managed cluster #1421

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,23 @@
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

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note

Set Global Variable can be replaced with VAR
Set Global Variable ${CATALOG_NAME} addon-managed-odh-catalog

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note

Set Global Variable can be replaced with VAR
#For managed cluster

Check warning

Code scanning / Robocop

Missing blank space after comment character Warning

Missing blank space after comment character
IF "${UPDATE_CHANNEL}" == "odh-nightlies"
Set Global Variable ${OPERATOR_NAMESPACE} openshift-marketplace

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note

Set Global Variable can be replaced with VAR
Set Global Variable ${SUB_NAME} rhoai-operator-dev

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note

Set Global Variable can be replaced with VAR
Set Global Variable ${CATALOG_NAME} rhoai-catalog-dev

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note

Set Global Variable can be replaced with VAR
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 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

Check warning

Code scanning / Robocop

Local variable '{{ name }}' is overwritten before usage Warning

Local variable '${return_code}' is overwritten before usage

Check warning

Code scanning / Robocop

Local variable '{{ name }}' is overwritten before usage Warning

Local variable '${output}' is overwritten before usage
... 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

Check warning

Code scanning / Robocop

Local variable '{{ name }}' is overwritten before usage Warning

Local variable '${return_code}' is overwritten before usage

Check warning

Code scanning / Robocop

Local variable '{{ name }}' is overwritten before usage Warning

Local variable '${output}' is overwritten before usage
... 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 @@
... 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

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning

Line is too long (130/120)
Verify Project Does Not Exists ${OPERATOR_NAMESPACE}
END
Loading