-
Notifications
You must be signed in to change notification settings - Fork 123
STOR-1459: Add fine-grained RBAC roles instead of cluster-admin role for cluster-storage-operator #741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aculnaig
wants to merge
23
commits into
openshift:main
Choose a base branch
from
aculnaig:stor-1459
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
STOR-1459: Add fine-grained RBAC roles instead of cluster-admin role for cluster-storage-operator #741
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
a7cd178
STOR-1459: Add fine-grained RBAC roles instead of cluster-admin role …
aculnaig 38db57b
STOR-1459: Refine fine-grained RBAC roles instead of cluster-admin fo…
aculnaig 04bb9c8
STOR-1459: Add StorageClass management permissions to cluster-storage…
aculnaig e93078e
STOR-1459: Replace cluster-admin with fine-grained RBAC for cluster-s…
aculnaig 1e15319
STOR-1459: Correct securityContext comments to accurately describe no…
aculnaig 3fd8ddc
STOR-1459: Update AGENTS.md to reflect consolidated RBAC implementation
aculnaig a2ae953
STOR-1459: Fix ClusterRoleBinding roleRef immutability in upgrade path
aculnaig 7c810cd
STOR-1459: Fix ClusterRoleBinding roleRef immutability in upgrade path
aculnaig 227f76d
STOR-1459: Use separate deletion manifest for HyperShift RBAC migration
aculnaig 7ae1ee8
STOR-1459: Update AGENTS.md to document immutable roleRef migration s…
aculnaig 78fc333
STOR-1459: Refactor RBAC to fine-grained Role-based architecture
aculnaig 77d0720
STOR-1459: Update AGENTS.md with newer RBAC fine-grained architecture…
aculnaig b4dc870
STOR-1459: Fix RBAC permission gaps discovered in operational testing
aculnaig e832613
STOR-1459: Fix additional RBAC permission gaps for secrets access
aculnaig da44017
STOR-1459: Fix all RBAC permission gaps discovered in operational tes…
aculnaig 1e3281c
STOR-1459: Split StorageClasses and CSI driver management rules
aculnaig 2a30531
STOR-1459: Remove clustercsidrivers/status permissions from CSO Clust…
aculnaig 2d28547
STOR-1459: Delete servicemonitors/prometheusrules rules from CSO clus…
aculnaig 24f068f
STOR-1459: Drop get rule on specific secrets in CSO's own namespace
aculnaig d15d186
STOR-1459: Remove deployments/scale and deployments/status from CSO n…
aculnaig 849db2c
STOR-1459: Remove deployments/status from CSI drivers namespace Role
aculnaig 1a9e2d7
STOR-1459: Document runlevel ordering for openshift-config namespace …
aculnaig d07f4c7
STOR-1459: Drop unused secret/RBAC reads from config namespace Roles
aculnaig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
manifests/08_0001_cluster_storage_operator_storage_role.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| kind: ClusterRole | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| metadata: | ||
| name: cluster-storage-operator-storage-role | ||
| annotations: | ||
| include.release.openshift.io/hypershift: "true" | ||
| include.release.openshift.io/ibm-cloud-managed: "true" | ||
| include.release.openshift.io/self-managed-high-availability: "true" | ||
| include.release.openshift.io/single-node-developer: "true" | ||
| capability.openshift.io/name: Storage | ||
| rules: | ||
| # Cluster infrastructure and configuration observation (cluster-scoped singletons) | ||
| # Required for determining platform capabilities, proxy settings, feature gates, and cluster health | ||
| - apiGroups: ["config.openshift.io"] | ||
| resources: ["infrastructures", "proxies", "clusterversions", "featuregates", "clusteroperators", "apiservers"] | ||
| verbs: ["get", "list", "watch"] | ||
|
|
||
| # Default StorageClass management — CSO creates/reconciles the cluster default SC | ||
| - apiGroups: ["storage.k8s.io"] | ||
| resources: ["storageclasses"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
|
||
| # CSI driver / VAC observation only — CSO watches these to make decisions and | ||
| # emit metrics; the objects themselves are managed by the CSI driver operators. | ||
| - apiGroups: ["storage.k8s.io"] | ||
| resources: ["csidrivers", "volumeattributesclasses"] | ||
| verbs: ["get", "list", "watch"] | ||
|
|
||
| # ClusterRoleBindings for CSI driver sidecar RBAC (cluster-scoped) | ||
| # Required to grant sidecar containers (provisioner, attacher, resizer, snapshotter) cluster-level permissions | ||
| # Note: Roles and RoleBindings in namespaces are handled by namespace-scoped Roles | ||
| - apiGroups: ["rbac.authorization.k8s.io"] | ||
| resources: ["clusterrolebindings"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
|
||
| # Storage operator custom resources (cluster-scoped) | ||
| # Required for managing the Storage CR and ClusterCSIDriver CRs for each platform | ||
| - apiGroups: ["operator.openshift.io"] | ||
| resources: ["storages", "clustercsidrivers"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
| - apiGroups: ["operator.openshift.io"] | ||
| resources: ["storages/status"] | ||
| verbs: ["get", "patch", "update"] | ||
|
|
||
| # Custom Resource Definitions management (cluster-scoped) | ||
| # Required for VolumeDataSourceValidator to deploy the VolumePopulator CRD | ||
| - apiGroups: ["apiextensions.k8s.io"] | ||
| resources: ["customresourcedefinitions"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
|
||
| # ClusterOperator status updates (cluster-scoped) | ||
| # Required by StatusSyncer controller to report operator health conditions | ||
| - apiGroups: ["config.openshift.io"] | ||
| resources: ["clusteroperators/status"] | ||
| verbs: ["patch", "update"] | ||
67 changes: 67 additions & 0 deletions
67
manifests/08_0002_cluster_storage_operator_operator_namespace_role.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| kind: Role | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| metadata: | ||
| name: cluster-storage-operator-role | ||
| namespace: openshift-cluster-storage-operator | ||
| annotations: | ||
| include.release.openshift.io/hypershift: "true" | ||
| include.release.openshift.io/ibm-cloud-managed: "true" | ||
| include.release.openshift.io/self-managed-high-availability: "true" | ||
| include.release.openshift.io/single-node-developer: "true" | ||
| capability.openshift.io/name: Storage | ||
| rules: | ||
| # Leader election via leases in operator's own namespace | ||
| - apiGroups: ["coordination.k8s.io"] | ||
| resources: ["leases"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
|
||
| # Event recording for operator status and lifecycle | ||
| - apiGroups: [""] | ||
| resources: ["events"] | ||
| verbs: ["create", "update", "patch"] | ||
|
|
||
| # ServiceAccount management for vSphere problem detector | ||
| - apiGroups: [""] | ||
| resources: ["serviceaccounts"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
|
||
| # Service management for metrics endpoint | ||
| - apiGroups: [""] | ||
| resources: ["services"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
|
||
| # CSO informs on all Secrets in its own namespace (informer requires list/watch, | ||
| # which already exposes full secret contents); vsphere-problem-detector reads | ||
| # vsphere-cloud-credentials and vsphere-problem-detector-serving-cert by name. | ||
| - apiGroups: [""] | ||
| resources: ["secrets"] | ||
| verbs: ["get", "list", "watch"] | ||
|
|
||
| # Monitoring resources for operator metrics | ||
| - apiGroups: ["monitoring.coreos.com"] | ||
| resources: ["servicemonitors", "prometheusrules"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
|
||
| # Deployment management for VolumeDataSourceValidator (library-go DeploymentController: | ||
| # Get/Create/Update/Delete on the Deployment; status is read via this rule, scale is unused) | ||
| - apiGroups: ["apps"] | ||
| resources: ["deployments"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
jsafrane marked this conversation as resolved.
|
||
|
|
||
| # ConfigMap management for operator configuration | ||
| # Required by ConfigObserver and other controllers that manage operator configuration data | ||
| - apiGroups: [""] | ||
| resources: ["configmaps"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
|
||
| # RBAC management in operator namespace | ||
| # Required to create and manage Roles and RoleBindings for operator components and sidecars | ||
| - apiGroups: ["rbac.authorization.k8s.io"] | ||
| resources: ["roles", "rolebindings"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
|
||
| # ReplicaSet observation for deployment status tracking | ||
| # Required to watch ReplicaSets created by Deployments for accurate status reporting | ||
| - apiGroups: ["apps"] | ||
| resources: ["replicasets"] | ||
| verbs: ["get", "list", "watch"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Deletion manifest for old cluster-admin binding in HyperShift — marked for deletion to avoid immutable roleRef conflict | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: cluster-storage-operator-role | ||
| annotations: | ||
| release.openshift.io/delete: "true" | ||
| include.release.openshift.io/hypershift: "true" | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: cluster-storage-operator | ||
| namespace: openshift-cluster-storage-operator | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: cluster-admin |
56 changes: 56 additions & 0 deletions
56
manifests/08_0003_cluster_storage_operator_csi_drivers_namespace_role.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| kind: Role | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| metadata: | ||
| name: cluster-storage-operator-csi-drivers-role | ||
| namespace: openshift-cluster-csi-drivers | ||
| annotations: | ||
| include.release.openshift.io/hypershift: "true" | ||
| include.release.openshift.io/ibm-cloud-managed: "true" | ||
| include.release.openshift.io/self-managed-high-availability: "true" | ||
| include.release.openshift.io/single-node-developer: "true" | ||
| capability.openshift.io/name: Storage | ||
| rules: | ||
| # ReplicaSet observation for owner reference resolution in deployment controller | ||
| - apiGroups: ["apps"] | ||
| resources: ["replicasets"] | ||
| verbs: ["get", "list", "watch"] | ||
|
|
||
| # Event recording for CSI driver operator lifecycle events | ||
| - apiGroups: [""] | ||
| resources: ["events"] | ||
| verbs: ["create", "update", "patch"] | ||
|
|
||
| # Deployment management for CSI driver operators (DeploymentController) | ||
| - apiGroups: ["apps"] | ||
| resources: ["deployments"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
|
||
| # ConfigMap management for driver operator configuration | ||
| - apiGroups: [""] | ||
| resources: ["configmaps"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
|
||
| # RBAC management for CSI driver operators (roles and rolebindings) | ||
| - apiGroups: ["rbac.authorization.k8s.io"] | ||
| resources: ["roles", "rolebindings"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
|
||
| # ServiceAccount management for CSI driver operators | ||
| - apiGroups: [""] | ||
| resources: ["serviceaccounts"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
|
||
| # Service management for CSI driver metrics and communication | ||
| - apiGroups: [""] | ||
| resources: ["services"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
|
||
| # Monitoring resources for CSI driver metrics | ||
| - apiGroups: ["monitoring.coreos.com"] | ||
| resources: ["servicemonitors", "prometheusrules"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
|
|
||
| # Secrets for CSI driver operators (e.g., cloud provider credentials) | ||
| - apiGroups: [""] | ||
| resources: ["secrets"] | ||
| verbs: ["get", "list", "watch"] |
17 changes: 17 additions & 0 deletions
17
manifests/08_0004_cluster_storage_operator_config_namespace_role.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| kind: Role | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| metadata: | ||
| name: cluster-storage-operator-config-role | ||
| namespace: openshift-config | ||
|
jsafrane marked this conversation as resolved.
|
||
| annotations: | ||
| include.release.openshift.io/hypershift: "true" | ||
| include.release.openshift.io/ibm-cloud-managed: "true" | ||
| include.release.openshift.io/self-managed-high-availability: "true" | ||
| include.release.openshift.io/single-node-developer: "true" | ||
| capability.openshift.io/name: Storage | ||
| rules: | ||
| # ConfigMap observation for cluster configuration (e.g., cloud provider config) | ||
| # Read-only access to configuration data | ||
| - apiGroups: [""] | ||
| resources: ["configmaps"] | ||
| verbs: ["get", "list", "watch"] | ||
17 changes: 17 additions & 0 deletions
17
manifests/08_0005_cluster_storage_operator_config_managed_namespace_role.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| kind: Role | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| metadata: | ||
| name: cluster-storage-operator-config-managed-role | ||
| namespace: openshift-config-managed | ||
| annotations: | ||
| include.release.openshift.io/hypershift: "true" | ||
| include.release.openshift.io/ibm-cloud-managed: "true" | ||
| include.release.openshift.io/self-managed-high-availability: "true" | ||
| include.release.openshift.io/single-node-developer: "true" | ||
| capability.openshift.io/name: Storage | ||
| rules: | ||
| # ConfigMap observation for managed cluster configuration (CA bundle sync | ||
| # via resourcesynccontroller). Read-only. | ||
| - apiGroups: [""] | ||
| resources: ["configmaps"] | ||
| verbs: ["get", "list", "watch"] |
84 changes: 84 additions & 0 deletions
84
manifests/08_0010_cluster_storage_operator_rolebindings.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| --- | ||
| # RoleBinding for openshift-cluster-storage-operator namespace | ||
| kind: RoleBinding | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| metadata: | ||
| name: cluster-storage-operator-role | ||
| namespace: openshift-cluster-storage-operator | ||
| annotations: | ||
| include.release.openshift.io/hypershift: "true" | ||
| include.release.openshift.io/ibm-cloud-managed: "true" | ||
| include.release.openshift.io/self-managed-high-availability: "true" | ||
| include.release.openshift.io/single-node-developer: "true" | ||
| capability.openshift.io/name: Storage | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: cluster-storage-operator | ||
| namespace: openshift-cluster-storage-operator | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: Role | ||
| name: cluster-storage-operator-role | ||
| --- | ||
| # RoleBinding for openshift-cluster-csi-drivers namespace | ||
| kind: RoleBinding | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| metadata: | ||
| name: cluster-storage-operator-csi-drivers-role | ||
| namespace: openshift-cluster-csi-drivers | ||
| annotations: | ||
| include.release.openshift.io/hypershift: "true" | ||
| include.release.openshift.io/ibm-cloud-managed: "true" | ||
| include.release.openshift.io/self-managed-high-availability: "true" | ||
| include.release.openshift.io/single-node-developer: "true" | ||
| capability.openshift.io/name: Storage | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: cluster-storage-operator | ||
| namespace: openshift-cluster-storage-operator | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: Role | ||
| name: cluster-storage-operator-csi-drivers-role | ||
| --- | ||
| # RoleBinding for openshift-config namespace | ||
| kind: RoleBinding | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| metadata: | ||
| name: cluster-storage-operator-config-role | ||
| namespace: openshift-config | ||
| annotations: | ||
| include.release.openshift.io/hypershift: "true" | ||
| include.release.openshift.io/ibm-cloud-managed: "true" | ||
| include.release.openshift.io/self-managed-high-availability: "true" | ||
| include.release.openshift.io/single-node-developer: "true" | ||
| capability.openshift.io/name: Storage | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: cluster-storage-operator | ||
| namespace: openshift-cluster-storage-operator | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: Role | ||
| name: cluster-storage-operator-config-role | ||
| --- | ||
| # RoleBinding for openshift-config-managed namespace | ||
| kind: RoleBinding | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| metadata: | ||
| name: cluster-storage-operator-config-managed-role | ||
| namespace: openshift-config-managed | ||
| annotations: | ||
| include.release.openshift.io/hypershift: "true" | ||
| include.release.openshift.io/ibm-cloud-managed: "true" | ||
| include.release.openshift.io/self-managed-high-availability: "true" | ||
| include.release.openshift.io/single-node-developer: "true" | ||
| capability.openshift.io/name: Storage | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: cluster-storage-operator | ||
| namespace: openshift-cluster-storage-operator | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: Role | ||
| name: cluster-storage-operator-config-managed-role |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.