Bug 1945149

Summary: [release-4.6] When deploying the operator via OLM (after creating the respective catalogsource), the deployment "lost" the `resources` section.
Product: OpenShift Container Platform Reporter: Joe Lanford <jlanford>
Component: OLMAssignee: Joe Lanford <jlanford>
OLM sub component: OLM QA Contact: Jian Zhang <jiazha>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: high CC: anbhatta, jiazha, jlanford, kuiwang, mjaros, vdinh, vkochuku, xzha
Version: 4.6Keywords: Triaged
Target Milestone: ---   
Target Release: 4.6.z   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1937375 Environment:
Last Closed: 2021-05-20 11:52:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1937375    
Bug Blocks:    

Comment 5 Jian Zhang 2021-05-11 02:40:18 UTC
mac:openshift-tests-private jianzhang$ oc get clusterversion
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.6.0-0.nightly-2021-05-08-154328   True        False         2m13s   Cluster version is 4.6.0-0.nightly-2021-05-08-154328

1, Create the CatalogSource
mac:openshift-tests-private jianzhang$ cat cs-bug.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  labels:
    olm-visibility: hidden
    opsrc-datastore: "true"
    opsrc-provider: reproducer
  name: reproducer-operators
  namespace: openshift-marketplace
spec:
  displayName: Reproducer Operators
  icon:
    base64data: ""
    mediatype: ""
  image: quay.io/jaeichle/reproducer-hello-world-index:0.0.1
  priority: -400
  publisher: jaeichle
  sourceType: grpc
  updateStrategy:
    registryPoll:
      interval: 100m0s
mac:openshift-tests-private jianzhang$ oc create -f cs-bug.yaml 
catalogsource.operators.coreos.com/reproducer-operators created

2, Subscribe to the helloworld-operator
mac:openshift-tests-private jianzhang$ cat sub.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: helloworld-operator
  namespace: default
spec:
  channel: alpha
  installPlanApproval: Automatic
  name: helloworld-operator
  source: reproducer-operators
  sourceNamespace: openshift-marketplace
  startingCSV: helloworld-operator.v0.0.1

mac:openshift-tests-private jianzhang$ oc get sub -n default
NAME                  PACKAGE               SOURCE                 CHANNEL
helloworld-operator   helloworld-operator   reproducer-operators   alpha

3, Check the resources of the CSV and Deployment, they should be same.
mac:openshift-tests-private jianzhang$ oc get csv helloworld-operator.v0.0.1  -o yaml -n default | grep limit -A 5
                  limits:
                    cpu: 500m
                    memory: 500Mi
                  requests:
                    cpu: 100m
                    memory: 100Mi

mac:openshift-tests-private jianzhang$ oc get deployment -n default helloworld-operator -o yaml |grep limit -A 5

          limits:
            cpu: 500m
            memory: 500Mi
          requests:
            cpu: 100m
            memory: 100Mi

mac:openshift-tests-private jianzhang$ oc get pods helloworld-operator-76cc59cb89-5hlmt -n default -o yaml |grep limit -A 5

      limits:
        cpu: 500m
        memory: 500Mi
      requests:
        cpu: 100m
        memory: 100Mi

4, add `subscription.spec.config.resources` to the subscription. Like: 

mac:openshift-tests-private jianzhang$ cat sub.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: helloworld-operator
  namespace: default
spec:
  channel: alpha
  installPlanApproval: Automatic
  name: helloworld-operator
  source: reproducer-operators
  sourceNamespace: openshift-marketplace
  startingCSV: helloworld-operator.v0.0.1
  config:
    resources:
      limits:
        cpu: 300m
        memory: 500Mi
      requests:
        cpu: 100m
        memory: 100Mi
mac:openshift-tests-private jianzhang$ oc apply -f sub.yaml 
Warning: oc apply should be used on resource created by either oc create --save-config or oc apply
subscription.operators.coreos.com/helloworld-operator configured

The resources of deployment have been changed to cpu 300m from 500m.
mac:openshift-tests-private jianzhang$ oc get deployment -n default helloworld-operator -o yaml |grep limit -A 5

          limits:
            cpu: 300m
            memory: 500Mi
          requests:
            cpu: 100m
            memory: 100Mi

The resources of CSV not changed.
mac:openshift-tests-private jianzhang$  oc get csv helloworld-operator.v0.0.1  -o yaml -n default | grep limit -A 5
                  limits:
                    cpu: 500m
                    memory: 500Mi
                  requests:
                    cpu: 100m
                    memory: 100Mi

LGTM, verify it.

Comment 7 errata-xmlrpc 2021-05-20 11:52:25 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 (OpenShift Container Platform 4.6.29 bug fix 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/RHBA-2021:1521