|
| 1 | +# **Knowledge Base Article: Why the OADP Operator Pod Requires `clusterPermissions` in the ClusterServiceVersion (CSV)** |
| 2 | + |
| 3 | +--- |
| 4 | + |
| 5 | +## **Rationale for Allowing `clusterPermissions` in the ClusterServiceVersion (CSV)** |
| 6 | + |
| 7 | +The **OADP Operator** specifies `clusterPermissions` in its **ClusterServiceVersion (CSV)** to obtain the required access for managing both namespaced and cluster-scoped resources, and for interacting with the Kubernetes API server properly. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## **Why the OADP Operator Requires Cluster-Level Access** |
| 12 | + |
| 13 | +The OADP Operator, which relies on Velero, manages backup and restore operations that involve not only namespace-scoped resources but also cluster-wide components. These include: |
| 14 | + |
| 15 | +- `ClusterRoles` |
| 16 | +- `ClusterRoleBindings` |
| 17 | +- `PersistentVolumes` |
| 18 | +- `StorageClasses` |
| 19 | +- `VolumeSnapshotClasses` |
| 20 | +- `CustomResourceDefinitions (CRDs)` |
| 21 | +- And more |
| 22 | + |
| 23 | +To perform these operations, both the OADP Operator and Velero must interact with cluster-scoped Kubernetes resources. These interactions—such as managing `ClusterRoles`, `PersistentVolumes`, and CRDs—require access to cluster-level API groups. |
| 24 | + |
| 25 | +Additionally, when configured to back up volume data without CSI snapshotting, elevated privileges are needed to access the underlying storage infrastructure and copy the volume data to the backup location. |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +## **Why `clusterPermissions` Are Essential** |
| 30 | + |
| 31 | +### **1. Ensuring Proper Access Control** |
| 32 | +- `clusterPermissions` explicitly define the Kubernetes API groups, verbs, and resources the operator can access. |
| 33 | +- This helps enforce the principle of least privilege by limiting access to only those permissions necessary for functionality. |
| 34 | + |
| 35 | +### **2. Facilitating Seamless Operator Functionality** |
| 36 | +- When declared in the CSV, `clusterPermissions` are granted automatically by OLM (Operator Lifecycle Manager) during installation. |
| 37 | +- This avoids the need for manual RBAC configuration and ensures backup and restore operations can run immediately and correctly. |
| 38 | + |
| 39 | +### **3. Compliance with Kubernetes Security Best Practices** |
| 40 | +- Declaring `clusterPermissions` within the CSV is a best practice for any operator that needs cluster-scoped access. |
| 41 | +- It increases transparency, simplifies audits, and ensures security requirements are met consistently. |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +## **Required RBAC Permissions** |
| 46 | + |
| 47 | +The following service accounts and permissions are necessary for full OADP functionality: |
| 48 | + |
| 49 | +### `non-admin-controller` Service Account |
| 50 | + |
| 51 | +Used for the **NonAdminBackup** feature. |
| 52 | + |
| 53 | +- **Core APIs**: |
| 54 | + - `namespaces`: get, list, watch |
| 55 | + - `secrets`: create, delete, get, list, patch, update, watch |
| 56 | + |
| 57 | +- **Custom Resources (`oadp.openshift.io`)**: |
| 58 | + - `dataprotectionapplications`: list |
| 59 | + - `nonadminbackups`, `nonadminbackupstoragelocationrequests`, `nonadminbackupstoragelocations`, `nonadmindownloadrequests`, `nonadminrestores`: full access |
| 60 | + - Finalizers: update |
| 61 | + - Status subresources: get, patch, update |
| 62 | + |
| 63 | +- **Velero (`velero.io`)**: |
| 64 | + - `backups`, `backupstoragelocations`, `deletebackuprequests`, `downloadrequests`, `restores`: full access |
| 65 | + - `backupstoragelocations/status`, `downloadrequests/status`: get, patch, update |
| 66 | + - `datadownloads`, `datauploads`, `podvolumebackups`, `podvolumerestores`: get, list, watch |
| 67 | + |
| 68 | +--- |
| 69 | + |
| 70 | +### `openshift-adp-controller-manager` Service Account |
| 71 | + |
| 72 | +Used by the OADP Operator controller. |
| 73 | + |
| 74 | +- **Core & Kubernetes APIs**: |
| 75 | + - `configmaps`, `endpoints`, `events`, `persistentvolumeclaims`, `pods`, `secrets`, `services`, `serviceaccounts`, `namespaces`: full access |
| 76 | + - `apps/daemonsets`, `apps/deployments`: full access |
| 77 | + - `coordination.k8s.io/secrets`: full access |
| 78 | + - `authentication.k8s.io/tokenreviews`, `authorization.k8s.io/subjectaccessreviews`: create |
| 79 | + |
| 80 | +- **OpenShift-specific**: |
| 81 | + - `cloudcredential.openshift.io/credentialsrequests`: create, get, update |
| 82 | + - `config.openshift.io/infrastructures`: get, list, watch |
| 83 | + - `security.openshift.io/securitycontextconstraints`: full access |
| 84 | + - Use of `privileged` SCC: use |
| 85 | + - `route.openshift.io/routes`: full access |
| 86 | + |
| 87 | +- **OADP CRDs**: |
| 88 | + - `cloudstorages`, `dataprotectionapplications`, `dataprotectiontests`: full access |
| 89 | + - Finalizers and statuses: update |
| 90 | + |
| 91 | +- **Monitoring**: |
| 92 | + - `monitoring.coreos.com/servicemonitors`: full access |
| 93 | + |
| 94 | +- **Velero Resources**: |
| 95 | + - `velero.io/*`: full access |
| 96 | + |
| 97 | +- **CSI Volume Snapshots**: |
| 98 | + - `snapshot.storage.k8s.io/volumesnapshots`, `volumesnapshotclasses`, `volumesnapshotcontents`: full access (except for create on some) |
| 99 | + |
| 100 | +--- |
| 101 | + |
| 102 | +### `velero` Service Account |
| 103 | + |
| 104 | +Used by Velero pods. |
| 105 | + |
| 106 | +- **Full Access to**: |
| 107 | + - All Velero resources (`velero.io/*`) |
| 108 | + - All OpenShift migration and build APIs |
| 109 | + - RBAC APIs |
| 110 | + - Core APIs including `serviceaccounts` |
| 111 | + - `packages.operators.coreos.com/packagemanifests` |
| 112 | + |
| 113 | +- **Non-resource URLs**: |
| 114 | + - All (`*`): all verbs |
| 115 | + |
| 116 | +- **SCC Usage**: |
| 117 | + - Use of the `privileged` SCC |
| 118 | + |
| 119 | +--- |
| 120 | + |
| 121 | +## **Conclusion** |
| 122 | + |
| 123 | +While `clusterPermissions` should always be evaluated carefully, they are crucial for the OADP Operator to deliver its core functionality. From managing cluster-scoped backup objects to integrating with storage that are not using CSI snapshotting, cloud credentials, and OpenShift security constructs, these permissions are what allow OADP and Velero to provide seamless and secure backup/restore operations. |
0 commit comments