Bug 1975581

Summary: OCS is still using deprecated api v1beta1
Product: [Red Hat Storage] Red Hat OpenShift Data Foundation Reporter: Yan Du <yadu>
Component: ocs-operatorAssignee: N Balachandran <nibalach>
Status: CLOSED ERRATA QA Contact: Joy John Pinto <jopinto>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.8CC: ebenahar, madam, mbukatov, muagarwa, nibalach, ocs-bugs, odf-bz-bot, sostapov, tdesala, uchapaga
Target Milestone: ---Keywords: AutomationBackLog
Target Release: ODF 4.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: v4.9.0-102.ci Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 1995635 (view as bug list) Environment:
Last Closed: 2021-12-13 17:44:31 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:    
Bug Blocks: 1995635    

Description Yan Du 2021-06-24 01:24:54 UTC
Description of problem:
OCS is still using deprecated api v1beta1

Version-Release number of selected component (if applicable):
Client Version: 4.8.0-202106130124.p0.git.1077b05.assembly.stream-1077b05
Server Version: 4.8.0-fc.7
Kubernetes Version: v1.21.0-rc.0+4b2b6ff

$ oc get csv -n openshift-storage
NAME                         DISPLAY                       VERSION        REPLACES                     PHASE
ocs-operator.v4.8.0-424.ci   OpenShift Container Storage   4.8.0-424.ci   ocs-operator.v4.8.0-422.ci   Succeeded

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:

The following APIs calls are deprecated: defaultdict(<class 'list'>, {'"oc/4.8.0 (linux/amd64) kubernetes/9dd45e3"': ['{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"5835735b-fa5f-4c61-bf6c-5073c070c27b","stage":"ResponseComplete","requestURI":"/apis/rbac.authorization.k8s.io/v1beta1/clusterrolebindings?fieldManager=kubectl-create","verb":"create","user":{"username":"system:admin","groups":["system:masters","system:authenticated"]},"sourceIPs":["10.1.156.2"],"userAgent":"oc/4.8.0 (linux/amd64) kubernetes/9dd45e3","objectRef":{"resource":"clusterrolebindings","name":"recycle-pvs-admin","apiGroup":"rbac.authorization.k8s.io","apiVersion":"v1beta1"},"responseStatus":{"metadata":{},"code":201},"requestReceivedTimestamp":"2021-06-22T20:22:48.639696Z","stageTimestamp":"2021-06-22T20:22:48.690197Z","annotations":{"authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":"","k8s.io/deprecated":"true","k8s.io/removed-release":"1.22"}}'], '"rook/v0.0.0 (linux/amd64) kubernetes/$Format"': ['{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"18214ed4-7036-4b7e-9bb6-b000d16b14da","stage":"ResponseComplete","requestURI":"/apis/storage.k8s.io/v1beta1/csidrivers/openshift-storage.rbd.csi.ceph.com","verb":"get","user":{"username":"system:serviceaccount:openshift-storage:rook-ceph-system","uid":"8c7c9128-e0b0-4582-8078-e68ab47e9ca9","groups":["system:serviceaccounts","system:serviceaccounts:openshift-storage","system:authenticated"]},"sourceIPs":["10.1.156.5"],"userAgent":"rook/v0.0.0 (linux/amd64) kubernetes/$Format","objectRef":{"resource":"csidrivers","name":"openshift-storage.rbd.csi.ceph.com","apiGroup":"storage.k8s.io","apiVersion":"v1beta1"},"responseStatus":{"metadata":{},"code":200},"requestReceivedTimestamp":"2021-06-23T02:32:44.950580Z","stageTimestamp":"2021-06-23T02:32:44.951771Z","annotations":{"authentication.k8s.io/legacy-token":"system:serviceaccount:openshift-storage:rook-ceph-system","authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":"RBAC: allowed by ClusterRoleBinding \\"ocs-operator.v4.8.0-424.ci-7d8b8979d9\\" of ClusterRole \\"ocs-operator.v4.8.0-424.ci-7d8b8979d9\\" to ServiceAccount \\"rook-ceph-system/openshift-storage\\"","k8s.io/deprecated":"true","k8s.io/removed-release":"1.22"}}', '{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"d3720f85-49a8-47cd-b336-fe518ec01f32","stage":"ResponseComplete","requestURI":"/apis/storage.k8s.io/v1beta1/csidrivers/openshift-storage.rbd.csi.ceph.com","verb":"get","user":{"username":"system:serviceaccount:openshift-storage:rook-ceph-system","uid":"8c7c9128-e0b0-4582-8078-e68ab47e9ca9","groups":["system:serviceaccounts","system:serviceaccounts:openshift-storage","system:authenticated"]},"sourceIPs":["10.1.156.7"],"userAgent":"rook/v0.0.0 (linux/amd64) kubernetes/$Format","objectRef":{"resource":"csidrivers","name":"openshift-storage.rbd.csi.ceph.com","apiGroup":"storage.k8s.io","apiVersion":"v1beta1"},"responseStatus":{"metadata":{},"code":200},"requestReceivedTimestamp":"2021-06-23T02:15:59.095756Z","stageTimestamp":"2021-06-23T02:15:59.096825Z","annotations":{"authentication.k8s.io/legacy-token":"system:serviceaccount:openshift-storage:rook-ceph-system","authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":"RBAC: allowed by ClusterRoleBinding \\"ocs-operator.v4.8.0-422.ci-7dd546c68c\\" of ClusterRole \\"ocs-operator.v4.8.0-422.ci-7dd546c68c\\" to ServiceAccount \\"rook-ceph-system/openshift-storage\\"","k8s.io/deprecated":"true","k8s.io/removed-release":"1.22"}}', '{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"e3dd6b88-8bb8-428b-a717-0afbf9c0d539","stage":"ResponseComplete","requestURI":"/apis/storage.k8s.io/v1beta1/csidrivers/openshift-storage.rbd.csi.ceph.com","verb":"update","user":{"username":"system:serviceaccount:openshift-storage:rook-ceph-system","uid":"8c7c9128-e0b0-4582-8078-e68ab47e9ca9","groups":["system:serviceaccounts","system:serviceaccounts:openshift-storage","system:authenticated"]},"sourceIPs":["10.1.156.7"],"userAgent":"rook/v0.0.0 (linux/amd64) kubernetes/$Format","objectRef":{"resource":"csidrivers","name":"openshift-storage.rbd.csi.ceph.com","apiGroup":"storage.k8s.io","apiVersion":"v1beta1","resourceVersion":"2464601"},"responseStatus":{"metadata":{},"code":200},"requestReceivedTimestamp":"2021-06-23T02:15:59.098092Z","stageTimestamp":"2021-06-23T02:15:59.101860Z","annotations":{"authentication.k8s.io/legacy-token":"system:serviceaccount:openshift-storage:rook-ceph-system","authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":"RBAC: allowed by ClusterRoleBinding \\"ocs-operator.v4.8.0-422.ci-7dd546c68c\\" of ClusterRole \\"ocs-operator.v4.8.0-422.ci-7dd546c68c\\" to ServiceAccount \\"rook-ceph-system/openshift-storage\\"","k8s.io/deprecated":"true","k8s.io/removed-release":"1.22"}}', '{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"4affe9f4-965b-44a6-a0a3-520a42f4932d","stage":"ResponseComplete","requestURI":"/apis/storage.k8s.io/v1beta1/csidrivers/openshift-storage.cephfs.csi.ceph.com","verb":"get","user":{"username":"system:serviceaccount:openshift-storage:rook-ceph-system","uid":"8c7c9128-e0b0-4582-8078-e68ab47e9ca9","groups":["system:serviceaccounts","system:serviceaccounts:openshift-storage","system:authenticated"]},"sourceIPs":["10.1.156.7"],"userAgent":"rook/v0.0.0 (linux/amd64) kubernetes/$Format","objectRef":{"resource":"csidrivers","name":"openshift-storage.cephfs.csi.ceph.com","apiGroup":"storage.k8s.io","apiVersion":"v1beta1"},"responseStatus":{"metadata":{},"code":200},"requestReceivedTimestamp":"2021-06-23T02:15:59.480789Z","stageTimestamp":"2021-06-23T02:15:59.500747Z","annotations":{"authentication.k8s.io/legacy-token":"system:serviceaccount:openshift-storage:rook-ceph-system","authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":"RBAC: allowed by ClusterRoleBinding \\"ocs-operator.v4.8.0-422.ci-7dd546c68c\\" of ClusterRole \\"ocs-operator.v4.8.0-422.ci-7dd546c68c\\" to ServiceAccount \\"rook-ceph-system/openshift-storage\\"","k8s.io/deprecated":"true","k8s.io/removed-release":"1.22"}}', '{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"adaf9a90-6549-4779-bc8e-ae13b97380d6","stage":"ResponseComplete","requestURI":"/apis/storage.k8s.io/v1beta1/csidrivers/openshift-storage.cephfs.csi.ceph.com","verb":"update","user":{"username":"system:serviceaccount:openshift-storage:rook-ceph-system","uid":"8c7c9128-e0b0-4582-8078-e68ab47e9ca9","groups":["system:serviceaccounts","system:serviceaccounts:openshift-storage","system:authenticated"]},"sourceIPs":["10.1.156.7"],"userAgent":"rook/v0.0.0 (linux/amd64) kubernetes/$Format","objectRef":{"resource":"csidrivers","name":"openshift-storage.cephfs.csi.ceph.com","apiGroup":"storage.k8s.io","apiVersion":"v1beta1","resourceVersion":"2464604"},"responseStatus":{"metadata":{},"code":200},"requestReceivedTimestamp":"2021-06-23T02:15:59.501598Z","stageTimestamp":"2021-06-23T02:15:59.503307Z","annotations":{"authentication.k8s.io/legacy-token":"system:serviceaccount:openshift-storage:rook-ceph-system","authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":"RBAC: allowed by ClusterRoleBinding \\"ocs-operator.v4.8.0-422.ci-7dd546c68c\\" of ClusterRole \\"ocs-operator.v4.8.0-422.ci-7dd546c68c\\" to ServiceAccount \\"rook-ceph-system/openshift-storage\\"","k8s.io/deprecated":"true","k8s.io/removed-release":"1.22"}}'], '"tests.test/v0.0.0 (linux/amd64) kubernetes/$Format"': ['{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"15ad9145-cfb6-4a4e-bde7-2c134bed5e6a","stage":"ResponseComplete","requestURI":"/apis/rbac.authorization.k8s.io/v1beta1/clusterrolebindings/kubevirt-testing-cluster-admin","verb":"delete","user":{"username":"system:admin","groups":["system:masters","system:authenticated"]},"sourceIPs":["10.1.156.3"],"userAgent":"tests.test/v0.0.0 (linux/amd64) kubernetes/$Format","objectRef":{"resource":"clusterrolebindings","name":"kubevirt-testing-cluster-admin","apiGroup":"rbac.authorization.k8s.io","apiVersion":"v1beta1"},"responseStatus":{"metadata":{},"status":"Failure","reason":"NotFound","code":404},"requestReceivedTimestamp":"2021-06-21T09:56:28.867394Z","stageTimestamp":"2021-06-21T09:56:28.868371Z","annotations":{"authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":"","k8s.io/deprecated":"true","k8s.io/removed-release":"1.22"}}']})

Expected results:
deprecated apis won't be used

Additional info:

Comment 2 Martin Bukatovic 2021-06-29 20:20:59 UTC
Providing qa ack based on today's bug triage meeting.

QE will verify this by sheer regression testing only.

Comment 5 N Balachandran 2021-07-30 10:41:06 UTC
Using 
kubectl get "$type" --all-namespaces --no-headers -o=custom-columns=NAME:.metadata.name,API-version:.metadata.managedFields[].apiVersion | grep beta


against ocs-operator.v4.8.0-175.ci on OCP 4.8, for the types deprecated in kubernetes 1.21, we get the following results:

 
ClusterRole :
ocs-metrics-exporter          rbac.authorization.k8s.io/v1beta1
 
ClusterRoleBinding :
ocs-metrics-exporter          rbac.authorization.k8s.io/v1beta1
 
Role :

noobaa-metrics                       rbac.authorization.k8s.io/v1beta1
ocs-metrics-svc                      rbac.authorization.k8s.io/v1beta1
rook-ceph-metrics                    rbac.authorization.k8s.io/v1beta1
rook-ceph-monitor                    rbac.authorization.k8s.io/v1beta1
 
RoleBinding :
noobaa-metrics                      rbac.authorization.k8s.io/v1beta1
ocs-metrics-svc                     rbac.authorization.k8s.io/v1beta1
rook-ceph-metrics                   rbac.authorization.k8s.io/v1beta1
rook-ceph-monitor                   rbac.authorization.k8s.io/v1beta1
 
 
CSIDriver :
openshift-storage.cephfs.csi.ceph.com   storage.k8s.io/v1beta1
openshift-storage.rbd.csi.ceph.com      storage.k8s.io/v1beta1

Comment 6 N Balachandran 2021-07-30 12:16:47 UTC
Upstream master PR: https://github.com/openshift/ocs-operator/pull/1287

Comment 7 N Balachandran 2021-07-30 12:19:13 UTC
@Yan Du,
The following are not created by OCS:
clusterrolebindings : kubevirt-testing-cluster-admin
clusterrolebindings : recycle-pvs-admin

Comment 8 N Balachandran 2021-07-30 13:26:44 UTC
The CSIDrivers will be updated to use the new API by Rook as part of https://bugzilla.redhat.com/show_bug.cgi?id=1982805

Comment 9 Yan Du 2021-08-02 01:12:45 UTC
@N Balachandran
clusterrolebindings : kubevirt-testing-cluster-admin is already fixed by the PR:https://github.com/kubevirt/kubevirt/pull/5915

Comment 15 Joy John Pinto 2021-10-19 10:18:17 UTC
Verified the bug with OCP version 4.9.0-0.nightly-2021-10-16-173626 and ODF odf-operator.v4.9.0. Please find attached doc for role or services and its respctive api version.

Comment 17 errata-xmlrpc 2021-12-13 17:44:31 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: Red Hat OpenShift Data Foundation 4.9.0 enhancement, 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:5086