Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1908990

Summary: The profile parser pod deployment and associated profiles should get removed after upgrade the compliance operator
Product: OpenShift Container Platform Reporter: xiyuan
Component: Compliance OperatorAssignee: Jakub Hrozek <jhrozek>
Status: CLOSED ERRATA QA Contact: Prashant Dhamdhere <pdhamdhe>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.6.zCC: josorior, mrogers, nkinder, xiyuan
Target Milestone: ---Keywords: UpcomingSprint
Target Release: 4.7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1908991 (view as bug list) Environment:
Last Closed: 2021-02-24 19:45:20 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:
Bug Depends On: 1905008    
Bug Blocks: 1908991    

Description xiyuan 2020-12-18 06:10:29 UTC
Description of problem:
The profile parser pod deployment and associated profiles should get removed after upgrade the compliance operator to latest version

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

How reproducible:
Always

Steps to Reproduce:
1. on stage cluster, install a compliance operator:
$oc create -f - <<EOF    
apiVersion: v1                          
kind: Namespace
metadata:
  name: up                        
  annotations:                    
    openshift.io/node-selector: ""
EOF                            
 
$ oc create -f - <<EOF    
apiVersion: operators.coreos.com/v1      
kind: OperatorGroup
metadata:
   name: openshift-compliance-abcd
   namespace: up                  
spec:                            
   targetNamespaces:                          
   - up
EOF
 
$ oc create -f - <<EOF    
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
   name: openshift-compliance-operator
   namespace: up                  
spec:                            
   channel: "4.6"                          
   Approval: Manual
   name: compliance-operator
   source: redhat-operators
   sourceNamespace: openshift-marketplace
EOF
 
$ oc get ip
NAME            CSV                           APPROVAL    APPROVED
install-xbqh7   compliance-operator.v0.1.17   Automatic   true
 
 
$ oc get csv -w
NAME                                           DISPLAY                  VERSION                 REPLACES   PHASE
compliance-operator.v0.1.17                    Compliance Operator      0.1.17                             Succeeded
elasticsearch-operator.4.6.0-202012050130.p0   Elasticsearch Operator   4.6.0-202012050130.p0              Succeeded

2. patch source in subscriptions which will have stage index image with latest version of operator:
$ oc patch subscriptions openshift-compliance-operator -p '{"spec":{"source":"qe-app-registry"}}' --type='merge'

3. check the ip and csv to makre sure operator upgrade finished:
$ oc get ip
NAME            CSV                           APPROVAL    APPROVED
install-cx59m   compliance-operator.v0.1.22   Automatic   true
install-xbqh7   compliance-operator.v0.1.17   Automatic   true
$ oc get csv
NAME                                           DISPLAY                  VERSION                 REPLACES                      PHASE
compliance-operator.v0.1.22                    Compliance Operator      0.1.22                  compliance-operator.v0.1.17   Succeeded
elasticsearch-operator.4.6.0-202012050130.p0   Elasticsearch Operator   4.6.0-202012050130.p0                                 Succeeded

Actual results:
The profile parser pod deployment and associated profiles does not get removed after upgrade the compliance operator to latest version

############Before upgrade, there are deployments for profiles:
oc get deployment
NAME                 READY  UP-TO-DATE  AVAILABLE  AGE
compliance-operator  1/1    1           1          5m
ocp4-pp              1/1    1           1          4m
rhcos4-pp            1/1    1           1          4m


############After upgrade, there are two new deployments for profile parser:
$ oc get deployment
NAME                  READY   UP-TO-DATE   AVAILABLE   AGE
compliance-operator   1/1     1            1           15m
ocp4-pp               1/1     1            1           14m
ocp4-up-pp            1/1     1            1           3m43s
rhcos4-pp             1/1     1            1           14m
rhcos4-up-pp          1/1     1            1           3m43s
$ oc get pod
NAME                                   READY   STATUS    RESTARTS   AGE
compliance-operator-84c495768b-zsgqb   1/1     Running   0          4m36s
ocp4-pp-5bbc8cb8db-4xdkg               1/1     Running   0          14m
ocp4-up-pp-bb856cb95-8n6sd             1/1     Running   0          3m37s
rhcos4-pp-6f5fdfbdb-wqwxv              1/1     Running   0          14m
rhcos4-up-pp-f84f7559-m7vfh            1/1     Running   0          3m37s
$ oc get profile.compliance
NAME              AGE
ocp4-cis          18m
ocp4-cis-node     18m
ocp4-e8           18m
ocp4-moderate     18m
ocp4-ncp          18m
rhcos4-e8         17m
rhcos4-moderate   17m
rhcos4-ncp        17m

$ oc delete deployment ocp4-pp rhcos4-pp
deployment.apps "ocp4-pp" deleted
deployment.apps "rhcos4-pp" deleted
$ oc get pod
NAME                                   READY   STATUS    RESTARTS   AGE
compliance-operator-84c495768b-zsgqb   1/1     Running   0          9m31s
ocp4-up-pp-bb856cb95-8n6sd             1/1     Running   0          8m32s
rhcos4-up-pp-f84f7559-m7vfh            1/1     Running   0          8m32s

Expected results
The profile parser pod deployment and associated profiles should get removed after upgrade the compliance operator to latest version


Additional info
Delete  deployment manually doesn't work. The ocp profiles still exist. 
$ oc get profile.compliance
NAME              AGE
ocp4-cis          18m
ocp4-cis-node     18m
ocp4-e8           18m
ocp4-moderate     18m
ocp4-ncp          18m
rhcos4-e8         18m
rhcos4-moderate   18m
rhcos4-ncp        18m

Comment 3 xiyuan 2020-12-23 09:45:12 UTC
new bundle image needed to verify this bug.

Comment 10 errata-xmlrpc 2021-02-24 19:45:20 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.7 compliance-operator image 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:0435