2020-09-03 11:01:43 +00:00
|
|
|
# RBAC file for the snapshot controller.
|
|
|
|
#
|
|
|
|
# The snapshot controller implements the control loop for CSI snapshot functionality.
|
|
|
|
# It should be installed as part of the base Kubernetes distribution in an appropriate
|
|
|
|
# namespace for components implementing base system functionality. For installing with
|
|
|
|
# Vanilla Kubernetes, kube-system makes sense for the namespace.
|
|
|
|
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ServiceAccount
|
|
|
|
metadata:
|
|
|
|
name: snapshot-controller
|
2022-01-14 20:58:26 +00:00
|
|
|
namespace: {{ snapshot_controller_namespace }}
|
2020-09-03 11:01:43 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
kind: ClusterRole
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
|
|
|
# rename if there are conflicts
|
|
|
|
name: snapshot-controller-runner
|
|
|
|
rules:
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources: ["persistentvolumes"]
|
|
|
|
verbs: ["get", "list", "watch"]
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources: ["persistentvolumeclaims"]
|
|
|
|
verbs: ["get", "list", "watch", "update"]
|
|
|
|
- apiGroups: ["storage.k8s.io"]
|
|
|
|
resources: ["storageclasses"]
|
|
|
|
verbs: ["get", "list", "watch"]
|
|
|
|
- apiGroups: [""]
|
|
|
|
resources: ["events"]
|
|
|
|
verbs: ["list", "watch", "create", "update", "patch"]
|
|
|
|
- apiGroups: ["snapshot.storage.k8s.io"]
|
|
|
|
resources: ["volumesnapshotclasses"]
|
|
|
|
verbs: ["get", "list", "watch"]
|
|
|
|
- apiGroups: ["snapshot.storage.k8s.io"]
|
|
|
|
resources: ["volumesnapshotcontents"]
|
|
|
|
verbs: ["create", "get", "list", "watch", "update", "delete"]
|
|
|
|
- apiGroups: ["snapshot.storage.k8s.io"]
|
|
|
|
resources: ["volumesnapshots"]
|
|
|
|
verbs: ["get", "list", "watch", "update"]
|
|
|
|
- apiGroups: ["snapshot.storage.k8s.io"]
|
|
|
|
resources: ["volumesnapshots/status"]
|
|
|
|
verbs: ["update"]
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: ClusterRoleBinding
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
|
|
|
name: snapshot-controller-role
|
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: snapshot-controller
|
2022-01-14 20:58:26 +00:00
|
|
|
namespace: {{ snapshot_controller_namespace }}
|
2020-09-03 11:01:43 +00:00
|
|
|
roleRef:
|
|
|
|
kind: ClusterRole
|
|
|
|
# change the name also here if the ClusterRole gets renamed
|
|
|
|
name: snapshot-controller-runner
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: Role
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
2022-01-14 20:58:26 +00:00
|
|
|
namespace: {{ snapshot_controller_namespace }}
|
2020-09-03 11:01:43 +00:00
|
|
|
name: snapshot-controller-leaderelection
|
|
|
|
rules:
|
|
|
|
- apiGroups: ["coordination.k8s.io"]
|
|
|
|
resources: ["leases"]
|
|
|
|
verbs: ["get", "watch", "list", "delete", "update", "create"]
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: RoleBinding
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
metadata:
|
|
|
|
name: snapshot-controller-leaderelection
|
2022-01-14 20:58:26 +00:00
|
|
|
namespace: {{ snapshot_controller_namespace }}
|
2020-09-03 11:01:43 +00:00
|
|
|
subjects:
|
|
|
|
- kind: ServiceAccount
|
|
|
|
name: snapshot-controller
|
2022-01-14 20:58:26 +00:00
|
|
|
namespace: {{ snapshot_controller_namespace }}
|
2020-09-03 11:01:43 +00:00
|
|
|
roleRef:
|
|
|
|
kind: Role
|
|
|
|
name: snapshot-controller-leaderelection
|
|
|
|
apiGroup: rbac.authorization.k8s.io
|