Bug 1860992

Summary: CNV upgrade - users are not removed from privileged SecurityContextConstraints
Product: Container Native Virtualization (CNV) Reporter: Ruth Netser <rnetser>
Component: VirtualizationAssignee: Igor Bezukh <ibezukh>
Status: CLOSED ERRATA QA Contact: Kedar Bidarkar <kbidarka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.4.0CC: cnv-qe-bugs, dvossel, fdeutsch, ibezukh, kbidarka, sgott, stirabos
Target Milestone: ---   
Target Release: 2.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-operator-container-v2.6.0-72 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-10 11:18:00 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 Ruth Netser 2020-07-27 15:49:41 UTC
Description of problem:
CNV 2.3 adds 3 openshift-cnv users to privileged  SecurityContextConstraints.
These are not added in 2.4.
When upgrading from 2.3 -> 2.4, the users are not removed.

Version-Release number of selected component (if applicable):
CNV 2.3.0 -> 2.4.0 upgrade

How reproducible:
100%

Steps to Reproduce:
1. CNV 2.3.0 -> 2.4.0 upgrade


Actual results:
oc get SecurityContextConstraints privileged -oyaml

users:
- system:admin
- system:serviceaccount:openshift-infra:build-controller
- system:serviceaccount:openshift-cnv:kubevirt-handler
- system:serviceaccount:openshift-cnv:kubevirt-apiserver
- system:serviceaccount:openshift-cnv:kubevirt-controller


Expected results:
Identical to 2.4:

$ oc get SecurityContextConstraints privileged -oyaml
users:
- system:admin
- system:serviceaccount:openshift-infra:build-controller


Additional info:

Comment 1 Simone Tiraboschi 2020-08-03 14:57:32 UTC
I tend to think that the right place to remove them is virt-operator.
Stu?

Comment 2 David Vossel 2020-08-03 17:25:21 UTC
yes, if anything is responsible for removing our SAs from a SCC, it's virt-operator.

Comment 3 sgott 2020-08-03 17:41:04 UTC
Aren't kubevirt-handler and kubevirt-controller still in use?

Which component creates build-controller? virt-operator certainly never created anything by that name.

Comment 4 David Vossel 2020-08-03 17:43:25 UTC
the new way of doing this is virt-operator creates SCCs specific for KubeVirt. we still need SCCS, just not to modify the default ones.  the 2.3 entries on default SCC should have been removed.

also, build-controller isn't related to us.  it's supposed to be on the default scc.

Comment 5 sgott 2020-08-03 19:50:17 UTC
Updating component to Virtualization.

Comment 6 Igor Bezukh 2020-09-09 12:30:46 UTC
PR submitted, waiting for code review

Comment 8 Fabian Deutsch 2020-11-18 13:13:27 UTC
The PR got merged, is there anything else that is needed?

Comment 9 Igor Bezukh 2020-11-18 13:34:21 UTC
Just the QE to verify it on CNV 2.6 cluster

Comment 10 Ruth Netser 2021-02-03 13:57:39 UTC
Verified 2.5.3 -> 2.6.0 upgrade.
Added the following to SecurityContextConstraints privileged, under users:

- system:serviceaccount:openshift-cnv:kubevirt-handler			
- system:serviceaccount:openshift-cnv:kubevirt-apiserver			
- system:serviceaccount:openshift-cnv:kubevirt-controller	


Before the upgrade:
		
$ oc get SecurityContextConstraints privileged -oyaml |grep -A6 users
f:users: {}
manager: kubectl-edit
operation: Update
time: "2021-02-02T08:47:59Z"
name: privileged
resourceVersion: "894696"
selfLink: /apis/security.openshift.io/v1/securitycontextconstraints/privileged
--
users:
- system:admin
- system:serviceaccount:openshift-infra:build-controller
- system:serviceaccount:openshift-cnv:kubevirt-handler
- system:serviceaccount:openshift-cnv:kubevirt-apiserver
- system:serviceaccount:openshift-cnv:kubevirt-controller
volumes:

After the upgrade:
$ oc get SecurityContextConstraints privileged -oyaml |grep -A6 users
      f:users: {}
    manager: virt-operator
    operation: Update
    time: "2021-02-03T13:45:23Z"
  name: privileged
  resourceVersion: "2200531"
  selfLink: /apis/security.openshift.io/v1/securitycontextconstraints/privileged
--
users:
- system:admin
- system:serviceaccount:openshift-infra:build-controller
volumes:
- '*'

Comment 13 errata-xmlrpc 2021-03-10 11:18:00 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 (Moderate: OpenShift Virtualization 2.6.0 security and 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/RHSA-2021:0799