Bug 2014079

Summary: Uninstall of ODF operator from UI doesn't remove noobaa and ocs-operator CSV and pods
Product: [Red Hat Storage] Red Hat OpenShift Data Foundation Reporter: Neha Berry <nberry>
Component: odf-operatorAssignee: Nitin Goyal <nigoyal>
Status: CLOSED CURRENTRELEASE QA Contact: Aman Agrawal <amagrawa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.9CC: amagrawa, badhikar, ebenahar, jefbrown, jijoy, jrivera, madam, mashetty, muagarwa, nigoyal, ocs-bugs, odf-bz-bot
Target Milestone: ---Keywords: AutomationBackLog
Target Release: ODF 4.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: v4.9.0-228.ci Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-01-07 17:46:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Neha Berry 2021-10-14 12:51:54 UTC
Description of problem (please be detailed as possible and provide log
snippests):
===========================================================================
Uninstall of ODF operator from UI->Installed Operators Page does not remove the ocs-operator and noobaa CSVs and UI doesn't even provide option to uninstall each separately

With odf-operator managing the ocs-operator, an uninstall of ODF-operator shoudl either take care of uninstall of all its dependent operators or we should get an option to uninstall all 3 opertaors from UI

With 4.9, noobaa opertaor is managed by noobaa CSV but  it is still installed during ODF-operator install, so should get removed on uninstall of odf-operator



The console plugin provided by this operator will be disabled and removed.

So it seems like a OLM bug after discussion with engineering as the checkbox option is not available
Version of all relevant components (if applicable):
====================================================
OCP = 4.9.0-0.nightly-2021-10-12-084355
OCS  = odf-operator.v4.9.0 () quay.io/rhceph-dev/ocs-registry:4.9.0-188.ci)


Does this issue impact your ability to continue to work with the product
(please explain in detail what is the user impact)?
==========================================================================
UI uninstall of operator does not delete all the dependent operators 

Is there any workaround available to the best of your knowledge?
====================================================================
Either
1) delete the namespace openshift-storage
2) Delete the leftover CSVs and subscription

Rate from 1 - 5 the complexity of the scenario you performed that caused this
bug (1 - very simple, 5 - very complex)?


Can this issue reproducible?
===================================
Always

Can this issue reproduce from the UI?
========================================
yes


If this is a regression, please provide more details to justify this:
========================================================================
Not sure

Steps to Reproduce:
1. Installed OCP 4.9
2. Removed the default operators
	#oc patch operatorhub.config.openshift.io/cluster -p='{"spec":{"disableAllDefaultSources":true}}' --type=merge  (only need pre-GA)
3. Create the catalogsource in Operator hub with the latest ODF-operator image
4. ODF 4.9 operator installed from UI which installed pods and CSVs listed in Additional Info->[1]. 
P.S :  Did not install the storagesystem

5. Uninstalled the Openshift Data Foundation operator from the Installed Operators->ODF operator page
Though the Installed Operators page->namespace-openshift Storage shows "No operand Found" but we still have the CSVs for ocs operator and noobaa in Succeeded state
See Additional Info-> [2] 




Actual results:
==================
It uninstalled and removed only the odf-operator.v4.9.0  but the other two operators(and CSV) keep running

Also, there is no indication in the UI which informs about the leftover operators.

See Additional Info-> [2]


Checked in the attached screenshot that it says to click on the checkbox to also remove the dependant operands but we do not have a checkbox in the dialog pop-up.



The UI message
--------------

 Uninstall Operator?
Operator OpenShift Data Foundation will be removed from openshift-storage. Click on the checkbox below to also remove all Operands associated with this Operator. If your Operator configured off-cluster resources, these will continue to run and require manual cleanup.


Expected results:
=======================
if install of ODF operator installs both ocs-operator and noobaa-operator, then uninstall of the same operator should take care of removing all the operators it installed and not just odf-operator




Additional info:
====================

[1] 
=======
Post install of Operator from Operator Hub
----------------------------------------------------

Thu Oct 14 12:43:48 PM UTC 2021
--------------
========CSV ======
NAME                     DISPLAY                       VERSION   REPLACES   PHASE
noobaa-operator.v4.9.0   NooBaa Operator               4.9.0                Succeeded
ocs-operator.v4.9.0      OpenShift Container Storage   4.9.0                Succeeded
odf-operator.v4.9.0      OpenShift Data Foundation     4.9.0                Succeeded
--------------
=======PODS ======
NAME                                               READY   STATUS    RESTARTS   AGE   IP             NODE                            NOMINATED NODE   READINESS GATES
noobaa-operator-684c7d8d4f-789r7                   1/1     Running   0          50s   10.129.2.240   nberry-o13-gqsjb-worker-lrxnc   <none>           <none>
ocs-metrics-exporter-8658c995d9-skrb4              1/1     Running   0          28s   10.131.0.77    nberry-o13-gqsjb-worker-jcwzr   <none>           <none>
ocs-operator-6968dcf5d5-fqlw6                      1/1     Running   0          29s   10.131.0.75    nberry-o13-gqsjb-worker-jcwzr   <none>           <none>
odf-console-56f9f6d7d6-pzv8n                       1/1     Running   0          71s   10.129.2.239   nberry-o13-gqsjb-worker-lrxnc   <none>           <none>
odf-operator-controller-manager-65cc746f9c-kzqwj   2/2     Running   0          71s   10.128.3.32    nberry-o13-gqsjb-worker-zj784   <none>           <none>
rook-ceph-operator-845cf86d9b-nmcpw                1/1     Running   0          28s   10.131.0.76    nberry-o13-gqsjb-worker-jcwzr   <none>           <none>

After uninstall of Operator from the Installed Operators page
----------------------------------------------------------------

Thu Oct 14 12:46:17 PM UTC 2021
--------------
========CSV ======
NAME                     DISPLAY                       VERSION   REPLACES   PHASE
noobaa-operator.v4.9.0   NooBaa Operator               4.9.0                Succeeded
ocs-operator.v4.9.0      OpenShift Container Storage   4.9.0                Succeeded
--------------
=======PODS ======
NAME                                    READY   STATUS    RESTARTS   AGE     IP             NODE                            NOMINATED NODE   READINESS GATES
noobaa-operator-684c7d8d4f-789r7        1/1     Running   0          3m19s   10.129.2.240   nberry-o13-gqsjb-worker-lrxnc   <none>           <none>
ocs-metrics-exporter-8658c995d9-skrb4   1/1     Running   0          2m57s   10.131.0.77    nberry-o13-gqsjb-worker-jcwzr   <none>           <none>
ocs-operator-6968dcf5d5-fqlw6           1/1     Running   0          2m58s   10.131.0.75    nberry-o13-gqsjb-worker-jcwzr   <none>           <none>
rook-ceph-operator-845cf86d9b-nmcpw     1/1     Running   0          2m57s   10.131.0.76    nberry-o13-gqsjb-worker-jcwzr   <none>           <none>

➜   oc get subscription 
NAME              PACKAGE           SOURCE             CHANNEL
noobaa-operator   noobaa-operator   redhat-operators   stable-4.9
ocs-operator      ocs-operator      redhat-operators   stable-4.9

Comment 10 Jose A. Rivera 2021-10-30 13:22:49 UTC
Due do some refactoring to take care of other BZs, we had to redo the implementation for this solution. It should probably be validated again...