Bug 2015023 - Operator objects are re-created even after deleting it
Summary: Operator objects are re-created even after deleting it
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.7
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ---
: 4.11.0
Assignee: Per da Silva
QA Contact: Bruno Andrade
URL:
Whiteboard:
Depends On:
Blocks: 2106838
TreeView+ depends on / blocked
 
Reported: 2021-10-18 09:11 UTC by Dhruv Gautam
Modified: 2023-09-18 04:27 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Broken thread safety around Operator API Consequence: Operator resources weren’t being properly deleted Fix: Fixed thread safety Result: Operator resources are being correctly deleted
Clone Of:
: 2106838 (view as bug list)
Environment:
Last Closed: 2022-08-10 10:38:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift operator-framework-olm pull 278 0 None Merged sync: Update staging directories 04-05 2022-04-07 10:00:33 UTC
Red Hat Knowledge Base (Solution) 5805841 0 None None None 2022-04-11 21:01:38 UTC
Red Hat Product Errata RHSA-2022:5069 0 None None None 2022-08-10 10:38:47 UTC

Description Dhruv Gautam 2021-10-18 09:11:17 UTC
Description of problem:
Tried to uninstall the operator and it worked. However, the operator custom resource doesn't gets deleted.
Strangely, it is getting recreated even after issuing "oc delete operator <name>"

Version-Release number of selected component (if applicable):
4.7.31

How reproducible:
100%

Steps to Reproduce:
1. Install any operator
2. Check operator resource
3. Uninstall the operator
4. Try to delete the "operator" resource.
5. List the operator resource. The operator resource will get recreated.

Actual results:
The operator resource is not getting removed even after deleting it.

Expected results:
After issuing "oc delete operator <name>", the operator resource should get removed.


Additional info:
Similar bug[1] was fix in 4.7.0 but looks like the issue is still there.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1899588

Comment 2 Nick Hale 2021-12-02 20:09:45 UTC
Sorry for the slow response!

@dgautam I'm going to need the status of the Operator resource _after_ the deletion attempt is made. That status should show any remaining components. Without that info, I can only suspect that some cluster scoped resources still exist that reference the Operator -- e.g. a CRD -- since I have been unable to reproduce the issue myself.

A must-gather will help too.

Comment 15 Per da Silva 2022-04-07 09:04:37 UTC
Hi Dhruv,

We've brought this change downstream on this PR: https://github.com/openshift/operator-framework-olm/pull/278

I'll update this ticket to ON_QA

Cheers,

Per

Comment 17 Bruno Andrade 2022-04-08 00:09:44 UTC
oc get clusterversion 
NAME      VERSION                              AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.11.0-0.nightly-2022-04-07-053433   True        False         4h25m   Cluster version is 4.11.0-0.nightly-2022-04-07-053433

oc exec olm-operator-67fc464567-8wl9l  -n openshift-operator-lifecycle-manager -- olm --version
OLM version: 0.19.0
git commit: 491ea010345b42d0ffd19208124e16bc8a9d1355

cat og-single.yaml 
kind: OperatorGroup
apiVersion: operators.coreos.com/v1
metadata:
  name: og-single1
  namespace: default
spec:
  targetNamespaces:
  - default

oc apply -f og-single.yaml 
operatorgroup.operators.coreos.com/og-single1 created

cat teiidcatsrc.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: teiid
  namespace: default
spec:
  displayName: "teiid Operators"
  image: quay.io/bandrade/teiid-index:1898500
  publisher: QE
  sourceType: grpc

oc create -f teiidcatsrc.yaml 
catalogsource.operators.coreos.com/teiid created

cat teiidsub.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: teiid
  namespace: default
spec:
  source: teiid
  sourceNamespace: default

  channel: alpha
  installPlanApproval: Automatic
  name: teiid

oc apply -f teiidsub.yaml 
subscription.operators.coreos.com/teiid created

oc get sub -n default                               
NAME    PACKAGE   SOURCE   CHANNEL
teiid   teiid     teiid    alpha

oc get ip -n default      
NAME            CSV            APPROVAL    APPROVED
install-psjsf   teiid.v0.3.0   Automatic   true

oc get csv
NAME           DISPLAY   VERSION   REPLACES   PHASE
teiid.v0.3.0   Teiid     0.3.0                Succeeded

oc get operators -n default
NAME                                                AGE
cluster-logging.openshift-logging                   5h14m
elasticsearch-operator.openshift-operators-redhat   5h14m
teiid.default                                       13m

oc delete sub teiid
subscription.operators.coreos.com "teiid" deleted

oc delete csv teiid.v0.3.0
clusterserviceversion.operators.coreos.com "teiid.v0.3.0" deleted

oc get operator teiid.default -o yaml
apiVersion: operators.coreos.com/v1
kind: Operator
metadata:
  creationTimestamp: "2022-04-07T23:22:22Z"
  generation: 1
  name: teiid.default
  resourceVersion: "146694"
  uid: d74c796d-7482-4caa-96ed-fbd401a35f19
spec: {}
status:
  components:
    labelSelector:
      matchExpressions:
      - key: operators.coreos.com/teiid.default
        operator: Exists


oc delete operator teiid.default -n default                                                                   1 ↵
warning: deleting cluster-scoped resources, not scoped to the provided namespace
operator.operators.coreos.com "teiid.default" deleted


oc get operator teiid.default -o yaml
Error from server (NotFound): operators.operators.coreos.com "teiid.default" not found

LGTM, marking as VERIFIED

Comment 31 errata-xmlrpc 2022-08-10 10:38:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Container Platform 4.11.0 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5069

Comment 33 Alexander Greene 2022-08-30 21:36:41 UTC
This bug is being referenced by many teams when they encounter an operator CR that cannot be deleted. Typically, this issue is seen when a user hasn't cleaned up all resources associated with the operator CR, the steps to do so are detailed here [1]. If the operator CR still has components listed in its `status.Components` array, OLM is working as intended.


The PR that is associated with this bug fixed an issue where the `operator CR` could not be deleted even if no components were associated with the `operator CR`. This bug fix will not be backported to 4.9 as that version of OLM is in maintenance mode.

Thanks,

Alex

Ref:
[1] https://github.com/operator-framework/olm-docs/pull/251/files

Comment 34 Red Hat Bugzilla 2023-09-18 04:27:11 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days


Note You need to log in before you can comment on or make changes to this bug.