Skip to content

Commit

Permalink
Merge pull request #186 from mpatlasov/Bind-sidecars-to-common-Cluste…
Browse files Browse the repository at this point in the history
…rRoles

STOR-1065: Rework sidecar bindings to bind common ClusterRoles
  • Loading branch information
openshift-merge-robot committed Jul 11, 2023
2 parents b490460 + 1836b23 commit abb28bf
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 72 deletions.
10 changes: 10 additions & 0 deletions assets/rbac/lease_leader_election_role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Role for electing leader by the operator
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: manila-csi-driver-lease-leader-election
namespace: openshift-manila-csi-driver
rules:
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "watch", "list", "delete", "update", "create"]
14 changes: 14 additions & 0 deletions assets/rbac/lease_leader_election_rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Grant controller access to leases
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: manila-csi-driver-lease-leader-election
namespace: openshift-manila-csi-driver
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: manila-csi-driver-lease-leader-election
subjects:
- kind: ServiceAccount
name: manila-csi-driver-controller-sa
namespace: openshift-manila-csi-driver
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: manila-csi-provisioner-binding
name: manila-csi-main-provisioner-binding
subjects:
- kind: ServiceAccount
name: manila-csi-driver-controller-sa
namespace: openshift-manila-csi-driver
roleRef:
kind: ClusterRole
name: manila-external-provisioner-role
name: openshift-csi-main-provisioner-role
apiGroup: rbac.authorization.k8s.io
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: manila-csi-snapshotter-binding
name: manila-csi-main-snapshotter-binding
subjects:
- kind: ServiceAccount
name: manila-csi-driver-controller-sa
namespace: openshift-manila-csi-driver
roleRef:
kind: ClusterRole
name: manila-external-snapshotter-role
name: openshift-csi-main-snapshotter-role
apiGroup: rbac.authorization.k8s.io
26 changes: 0 additions & 26 deletions assets/rbac/provisioner_role.yaml

This file was deleted.

38 changes: 0 additions & 38 deletions assets/rbac/snapshotter_role.yaml

This file was deleted.

12 changes: 12 additions & 0 deletions assets/rbac/volumeattachment_reader_provisioner_binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: manila-csi-volumeattachment-reader-provisioner-binding
subjects:
- kind: ServiceAccount
name: manila-csi-driver-controller-sa
namespace: openshift-manila-csi-driver
roleRef:
kind: ClusterRole
name: openshift-csi-provisioner-volumeattachment-reader-role
apiGroup: rbac.authorization.k8s.io
9 changes: 5 additions & 4 deletions pkg/operator/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,18 @@ func RunOperator(ctx context.Context, controllerConfig *controllercmd.Controller
// leading to an initial admission failure. We avoid
// this by exploiting the fact that the pods cannot be
// scheduled until the SA has been created.
"rbac/snapshotter_binding.yaml",
"rbac/snapshotter_role.yaml",
"rbac/provisioner_binding.yaml",
"rbac/provisioner_role.yaml",
"rbac/main_snapshotter_binding.yaml",
"rbac/main_provisioner_binding.yaml",
"rbac/volumeattachment_reader_provisioner_binding.yaml",
"rbac/privileged_role.yaml",
"rbac/controller_privileged_binding.yaml",
"rbac/node_privileged_binding.yaml",
"rbac/kube_rbac_proxy_role.yaml",
"rbac/kube_rbac_proxy_binding.yaml",
"rbac/prometheus_role.yaml",
"rbac/prometheus_rolebinding.yaml",
"rbac/lease_leader_election_role.yaml",
"rbac/lease_leader_election_rolebinding.yaml",
"controller_sa.yaml",
"controller_pdb.yaml",
"node_sa.yaml",
Expand Down

0 comments on commit abb28bf

Please sign in to comment.