---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ .Release.Name }}-kcsi
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: {{ .Release.Name }}-kcsi
rules:
- apiGroups: ["cdi.kubevirt.io"]
  resources: ["datavolumes"]
  verbs: ["get", "create", "delete"]
- apiGroups: ["kubevirt.io"]
  resources: ["virtualmachineinstances"]
  verbs: ["list", "get"]
- apiGroups: ["subresources.kubevirt.io"]
  resources: ["virtualmachineinstances/addvolume", "virtualmachineinstances/removevolume"]
  verbs: ["update"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: {{ .Release.Name }}-kcsi
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ .Release.Name }}-kcsi
subjects:
- kind: ServiceAccount
  name: {{ .Release.Name }}-kcsi
