{{- if .Values.serviceAccount.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: {{ include "datalore.fullname" . }}
  labels:
    {{- include "datalore.labels" . | nindent 4 }}
rules:
  - apiGroups: [ "" ]
    resources: [ "services", "pods" ]
    verbs: [ "create", "delete", "get", "list", "patch" ]
  - apiGroups: [ "" ]
    resources: [ "pods/exec" ]
    verbs: [ "get" ]
  - apiGroups: [ "batch" ]
    resources: [ "jobs" ]
    verbs: [ "create", "delete", "get", "list", "deletecollection" ]
{{- end }}
