Bug 1858182

Summary: The Compliance-Operator pod crashes at compliancescan.getPVCForScan()
Product: OpenShift Container Platform Reporter: Prashant Dhamdhere <pdhamdhe>
Component: Compliance OperatorAssignee: Jakub Hrozek <jhrozek>
Status: CLOSED ERRATA QA Contact: Prashant Dhamdhere <pdhamdhe>
Severity: high Docs Contact:
Priority: high    
Version: 4.6CC: josorior, mrogers, nkinder, xiyuan
Target Milestone: ---Keywords: UpcomingSprint
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: v0.1.11 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 16:15:30 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:

Description Prashant Dhamdhere 2020-07-17 06:53:11 UTC
Description of problem:

The Compliance-Operator pod crashes with the following backtraces after the deletion of ComplianceSuite.


$ oc logs pod/compliance-operator-6bcbf66d5b-v2nzq 

E0716 11:29:35.420853       1 runtime.go:78] Observed a panic: &errors.errorString{s:"cannot parse '': quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$'"} (cannot parse '': quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$') 
goroutine 3698 [running]: 
k8s.io/apimachinery/pkg/util/runtime.logPanic(0x21d6040, 0xc000a48550) 
    /go/src/github.com/openshift/compliance-operator/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:74 +0xc4    
k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0) 
    /go/src/github.com/openshift/compliance-operator/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:48 +0xbe 
panic(0x21d6040, 0xc000a48550) 
    /usr/lib/golang/src/runtime/panic.go:679 +0x1b2 
k8s.io/apimachinery/pkg/api/resource.MustParse(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) 
    /go/src/github.com/openshift/compliance-operator/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go:127 +0x23d 
github.com/openshift/compliance-operator/pkg/controller/compliancescan.getPVCForScan(0xc000383b00, 0x0)         <<------------ 
    /go/src/github.com/openshift/compliance-operator/pkg/controller/compliancescan/rawresults.go:80 +0x1a3 
github.com/openshift/compliance-operator/pkg/controller/compliancescan.(*ReconcileComplianceScan).deleteRawResultsForScan(0xc000518390, 0xc000383b00, 0x2753160, 0xc00106dac0) 

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

4.6.0-0.nightly-2020-07-16-005008

How reproducible:

Always 

Steps to Reproduce:

1  Create 'openshift-compliance' namespace 

$ oc create -f compliance-operator/deploy/ns.yaml   

2. Switch to 'openshift-compliance' namespace 

$ oc project openshift-compliance 

3. Deploy all CustomResourceDefinition. 

$ for f in $(ls -1 compliance-operator/deploy/crds/*crd.yaml); do oc create -f $f; done 

4. Deploy compliance-operator 

$ oc create -f compliance-operator/deploy/ 

5. Deploy compliancesuite CR  

$ oc create -f - <<EOF 
apiVersion: compliance.openshift.io/v1alpha1 
kind: ComplianceSuite 
metadata: 
  name: example-compliancesuite 
spec: 
  autoApplyRemediations: false 
  schedule: "0 1 * * *" 
  scans: 
    - name: workers-scan 
      profile: xccdf_org.ssgproject.content_profile_moderate 
      content: ssg-rhcos4-ds.xml 
      contentImage: quay.io/complianceascode/ocp4:latest 
      debug: true 
      nodeSelector: 
        node-role.kubernetes.io/worker: "" 
EOF 

6. Compliance scan will not perform on worker nodes 

$ oc get pods 
NAME                                   READY   STATUS    RESTARTS   AGE 
compliance-operator-6bcbf66d5b-pkddc   1/1     Running   0          3m49s 
compliance-operator-6bcbf66d5b-v2nzq   1/1     Running   0          3m49s 
compliance-operator-6bcbf66d5b-zphcg   1/1     Running   0          3m49s 
ocp4-pp-59466846fd-kr2gb               1/1     Running   0          3m6s 
rhcos4-pp-6845f5dcd-894j9              1/1     Running   0          3m6s 

7. ComplianceSuite result shows empty  

$ oc get compliancesuite 
NAME                      PHASE   RESULT 
example-compliancesuite            

8. Delete the ComplianceSuite  

$ oc delete compliancesuite example-compliancesuite 

9. Monitor pods status, one of the pod crashes in Error state 

$ oc get pods -w 
NAME                                   READY   STATUS    RESTARTS   AGE 
compliance-operator-6bcbf66d5b-pkddc   1/1     Running   0          6m42s 
compliance-operator-6bcbf66d5b-v2nzq   0/1     Error     3          6m42s 
compliance-operator-6bcbf66d5b-zphcg   1/1     Running   0          6m42s 
ocp4-pp-59466846fd-kr2gb               1/1     Running   0          5m59s 
rhcos4-pp-6845f5dcd-894j9              1/1     Running   0          5m59s 

10. Once the pod crashes, check the pod logs for backtraces 

$ oc logs pod/compliance-operator-6bcbf66d5b-v2nzq 

E0716 11:29:35.420853       1 runtime.go:78] Observed a panic: &errors.errorString{s:"cannot parse '': quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$'"} (cannot parse '': quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$') 
goroutine 3698 [running]: 
k8s.io/apimachinery/pkg/util/runtime.logPanic(0x21d6040, 0xc000a48550) 
    /go/src/github.com/openshift/compliance-operator/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:74 +0xc4    
k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0) 
    /go/src/github.com/openshift/compliance-operator/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:48 +0xbe Share
panic(0x21d6040, 0xc000a48550) 
    /usr/lib/golang/src/runtime/panic.go:679 +0x1b2 
k8s.io/apimachinery/pkg/api/resource.MustParse(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) 
    /go/src/github.com/openshift/compliance-operator/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go:127 +0x23d 
github.com/openshift/compliance-operator/pkg/controller/compliancescan.getPVCForScan(0xc000383b00, 0x0)                 <<-------- 
    /go/src/github.com/openshift/compliance-operator/pkg/controller/compliancescan/rawresults.go:80 +0x1a3 
github.com/openshift/compliance-operator/pkg/controller/compliancescan.(*ReconcileComplianceScan).deleteRawResultsForScan(0xc000518390, 0xc000383b00, 0x2753160, 0xc00106dac0) 


Actual results:

The Compliance-Operator pod crashes at compliancescan.getPVCForScan() 

Expected results:

The Compliance-Operator pod should not crash after deleting of ComplianceSuite 

Additional info:

Comment 7 errata-xmlrpc 2020-10-27 16:15:30 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 GA Images), 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:4196