Bug 1808465 - Namespaced Dynamic Resources should not have the installPlan as their owner
Summary: Namespaced Dynamic Resources should not have the installPlan as their owner
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.4
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.4.0
Assignee: Nick Hale
QA Contact: Bruno Andrade
URL:
Whiteboard:
Depends On: 1808113
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-02-28 15:11 UTC by Alexander Greene
Modified: 2020-05-04 11:44 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-04 11:43:49 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github operator-framework operator-lifecycle-manager pull 1351 0 None closed [release-4.4] Bug 1808465: Fix OwnerReferences for bundled CRs 2020-10-21 07:51:40 UTC
Red Hat Product Errata RHBA-2020:0581 0 None None None 2020-05-04 11:44:08 UTC

Description Alexander Greene 2020-02-28 15:11:20 UTC
This bug was initially created as a copy of Bug #1808113

I am copying this bug because: 
4.4 should include the fix.


Description of problem:
Dynamic Resources (I.E. The PrometheusRule and ServiceMonitor resources) stored in the bundle have the installPlan as their Owner.The owner should be the CSV.

This bug was introduced at [1] in the code.

Version-Release number of selected component (if applicable):
4.4 and beyond

How reproducible:
Always

Steps to Reproduce:
1. Install an operator whose bundle includes a Prometheus Resource
2. Delete the CSV

Actual results:
The Prometheus resource still exists.

Expected results:
The Prometheus resource should no longer exist.

Additional info:
[1] https://github.com/operator-framework/operator-lifecycle-manager/blob/master/pkg/controller/operators/catalog/operator.go#L1725

Comment 3 Bruno Andrade 2020-03-06 16:46:35 UTC
OwnerReferences were added to PrometheusRule and ServiceMonitor objects as expected. Marking as VERIFIED.

Cluster Version: 4.4.0-0.nightly-2020-03-06-073549

Steps used to reproduce:

1. Install an operator whose bundle includes a Prometheus Resource

oc get csv -n test-operators                                     
NAME                        DISPLAY               VERSION   REPLACES   PHASE
etcdoperator.v0.9.4         etcd                  0.9.4                Succeeded
prometheusoperator.0.32.0   Prometheus Operator   0.32.0               Succeeded

2. Check OwnerReferences for ServiceMonitor and PrometheusRule objects:

oc get ServiceMonitor my-servicemonitor -o yaml -n test-operators
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  creationTimestamp: "2020-03-06T16:30:42Z"
  generation: 1
  labels:
    app: olm-operator
  name: my-servicemonitor
  namespace: test-operators
  ownerReferences:
  - apiVersion: operators.coreos.com/v1alpha1
    blockOwnerDeletion: false
    controller: false
    kind: ClusterServiceVersion
    name: etcdoperator.v0.9.4
    uid: b5bca235-1501-4d60-aeb3-cdd83cf0002a

oc get PrometheusRule my-prometheusrule -n test-operators -o yaml
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  creationTimestamp: "2020-03-06T16:30:42Z"
  generation: 1
  labels:
    prometheus: alert-rules
    role: alert-rules
  name: my-prometheusrule
  namespace: test-operators
  ownerReferences:
  - apiVersion: operators.coreos.com/v1alpha1
    blockOwnerDeletion: false
    controller: false
    kind: ClusterServiceVersion
    name: etcdoperator.v0.9.4
    uid: b5bca235-1501-4d60-aeb3-cdd83cf0002a

3. Delete csv and check if PrometheusRule and ServiceMonitor objects are deleted.

oc delete csv etcdoperator.v0.9.4 -n test-operators     
clusterserviceversion.operators.coreos.com "etcdoperator.v0.9.4" deleted

oc get ServiceMonitor,PrometheusRule -n test-operators 
No resources found in test-operators namespace.

Comment 5 errata-xmlrpc 2020-05-04 11:43:49 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, 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/RHBA-2020:0581


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