apiVersion: v1
kind: ServiceAccount
metadata:
  name: openstack-manila-csi-controllerplugin
  labels:
    app: openstack-manila-csi
    component: controllerplugin
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: openstack-manila-csi-controllerplugin
  labels:
    app: openstack-manila-csi
    component: controllerplugin
aggregationRule:
  clusterRoleSelectors:
    - matchLabels:
        rbac.manila.csi.openstack.org/aggregate-to-openstack-manila-csi-controllerplugin: "true"
rules: []
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: openstack-manila-csi-controllerplugin-rules
  labels:
    app: openstack-manila-csi
    component: controllerplugin
    rbac.manila.csi.openstack.org/aggregate-to-openstack-manila-csi-controllerplugin: "true"
rules:
  - apiGroups: [""]
    resources: ["nodes"]
    verbs: ["get", "list", "watch"]
  - apiGroups: [""]
    resources: ["secrets"]
    verbs: ["get", "list"]
  - apiGroups: [""]
    resources: ["persistentvolumes"]
    verbs: ["get", "list", "watch", "create", "delete"]
  - apiGroups: [""]
    resources: ["persistentvolumeclaims"]
    verbs: ["get", "list", "watch", "update"]
  - apiGroups: [""]
    resources: ["events"]
    verbs: ["list", "watch", "create", "update", "patch"]
  - apiGroups: ["storage.k8s.io"]
    resources: ["storageclasses"]
    verbs: ["get", "list", "watch"]
  - apiGroups: ["storage.k8s.io"]
    resources: ["csinodes"]
    verbs: ["get", "list", "watch"]
  - 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"]
  - apiGroups: ["apiextensions.k8s.io"]
    resources: ["customresourcedefinitions"]
    verbs: ["create", "list", "watch", "delete", "get", "update"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: openstack-manila-csi-controllerplugin
  labels:
    app: openstack-manila-csi
    component: controllerplugin
subjects:
  - kind: ServiceAccount
    name: openstack-manila-csi-controllerplugin
    namespace: default
roleRef:
  kind: ClusterRole
  name: openstack-manila-csi-controllerplugin
  apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: openstack-manila-csi-controllerplugin
  labels:
    app: openstack-manila-csi
    component: controllerplugin
rules:
  - apiGroups: [""]
    resources: ["endpoints"]
    verbs: ["get", "watch", "list", "delete", "update", "create"]
  - apiGroups: [""]
    resources: ["configmaps"]
    verbs: ["get", "list", "watch", "create", "delete"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: openstack-manila-csi-controllerplugin
  labels:
    app: openstack-manila-csi
    component: controllerplugin
subjects:
  - kind: ServiceAccount
    name: openstack-manila-csi-controllerplugin
    namespace: default
roleRef:
  kind: Role
  name: openstack-manila-csi-controllerplugin
  apiGroup: rbac.authorization.k8s.io
