Bug 1723672

Summary: [marketplace] Specify right owner kind in child resources' labels
Product: OpenShift Container Platform Reporter: Fan Jia <jfan>
Component: OLMAssignee: lgallett
OLM sub component: OperatorHub QA Contact: Fan Jia <jfan>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: aravindh, chezhang, dyan, jiazha
Version: 4.2.0   
Target Milestone: ---   
Target Release: 4.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-16 06:32:26 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 Fan Jia 2019-06-25 06:38:13 UTC
Description of problem:
Currently the csc label is propagated to child resources created by opsrc which wrongly informs that these child resources were created by csc when they were created by an opsrc. 

Version-Release number of selected component (if applicable):
cv: 4.2.0-0.nightly-2019-06-24-160709
marketplace: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:86b40723079613bca637e91f45252c52774738cbebb0c98f288a8bd833ec1251
commit: 1cbd326243493ff9ec589a542fa335fdc84dc3e7

How reproducible:
always

Steps to Reproduce:
1.install a cluster
2.create an opsrc by yaml
###########
apiVersion: "operators.coreos.com/v1"
kind: "OperatorSource"
metadata:
  name: "testkey"
  namespace: "openshift-marketplace"
  labels:
    opsrc-provider: testkey
spec:
  type: appregistry
  endpoint: "https://quay.io/cnr"
  registryNamespace: "jfan"
  displayName: "testkey"
  publisher: "testkey"
#############

Actual results:
1.after step 2 the child resources created by opsrc :”catalogsource,service,deployment,replicaset,pod” have the labels about csc

# oc describe catalogsource testkey | grep csc
Labels:       csc-owner-name=testkey
              csc-owner-namespace=openshift-marketplace


# oc describe service testkey | grep csc
Labels:            csc-owner-name=testkey
                   csc-owner-namespace=openshift-marketplace

# oc describe deployment testkey | grep csc
Labels:                 csc-owner-name=testkey
                        csc-owner-namespace=openshift-marketplace

# oc describe pod testkey-59f64fd6b6-ghckx
Name:               testkey-59f64fd6b6-ghckx
Namespace:          openshift-marketplace
Labels:             marketplace.catalogSourceConfig=testkey


# oc describe replicaset testkey-59f64fd6b6
Name:           testkey-59f64fd6b6
Namespace:      openshift-marketplace
Selector:       marketplace.catalogSourceConfig=testkey,pod-template-hash=59f64fd6b6
Labels:         marketplace.catalogSourceConfig=testkey

Expected results:
1.should change the label from “csc” to “opsrc” for the child resources created by opsrcs

Additional info:

Comment 1 Fan Jia 2019-07-18 10:02:56 UTC
test env:

4.2.0-0.nightly-2019-07-18-032637

test result:

1.check the opsrc "redhat-operators" child resource , the owner lables of resources from opsrc:

1)$ oc describe catalogsource redhat-operators | grep "owner"
opsrc-owner-name=redhat-operators
opsrc-owner-namespace=openshift-marketplace
2)$ oc describe service redhat-operators | grep "owner"
Labels: opsrc-owner-name=redhat-operators
opsrc-owner-namespace=openshift-marketplace
3)$ oc describe deployment redhat-operators | grep "owner"
Labels: opsrc-owner-name=redhat-operators
opsrc-owner-namespace=openshift-marketplace

2.create a csc "simplecsc" and check the owner lables of resources from csc:

1)$ oc describe deployment simplecsc | grep "owner"
Labels: csc-owner-name=simplecsc
csc-owner-namespace=openshift-marketplace
2)$ oc describe service simplecsc | grep "owner"
Labels: csc-owner-name=simplecsc
csc-owner-namespace=openshift-marketplace
3)$ oc describe catalogsource simplecsc -n openshift-operators | grep "owner"
Labels: csc-owner-name=simplecsc
csc-owner-namespace=openshift-marketplace

Comment 2 errata-xmlrpc 2019-10-16 06:32:26 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-2019:2922