operator-framework / operator-lifecycle-manager

A management framework for extending Kubernetes with Operators
https://olm.operatorframework.io
Apache License 2.0
1.72k stars 545 forks source link

after delete subscription and csv, the operator instance still exist in cluster #2850

Open wondersong opened 2 years ago

wondersong commented 2 years ago

Bug Report

What did you do? I deployed the catalog and subscription for CP4BA and then I did the subscript and csv, but found there is still some dirty data leave in the OCp cluster.

apiVersion: operators.coreos.com/v1
kind: Operator
metadata:
creationTimestamp: '2022-03-15T16:05:48Z'
generation: 1
managedFields:
- apiVersion: operators.coreos.com/v1
fieldsType: FieldsV1
fieldsV1:
'f:spec': {}
'f:status':
.: {}
'f:components':
.: {}
'f:labelSelector':
.: {}
'f:matchExpressions': {}
manager: olm
operation: Update
time: '2022-03-15T16:05:48Z'
name: ibm-cp4a-operator.dba22012205ter3
resourceVersion: '301963499'
uid: 0c1383b3-10d7-4666-b618-85cafc3b30b9
spec: {}
status:
components:
labelSelector:
matchExpressions:
- key: operators.coreos.com/ibm-cp4a-operator.dba22012205ter3
operator: Exists

What did you expect to see? The above ibm-cp4a-operator.dba22012205ter3 of operator should be deleted also.

What did you see instead? Under which circumstances? A clear and concise description of what you expected to happen (or insert a code snippet).

Environment

Possible Solution

Additional context Add any other context about the problem here.

exdx commented 2 years ago

Hi @wondersong, it's likely there is still some leftover artifacts from the operator, such as CRDs, that are considered part of the operator installation and remain on the cluster, even after the CSV and subscription is removed. If you were to remove the CRDs, the Operator object should go away. OLM does not remove CRDs by default.

This UX is unfortunate, and confusing to users. In the newer APIs we remove CRDs associated with an operator on deletion as well.