{{- if and .Values.curator.enabled .Values.curator.rbac.enabled }}
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: {{ include "elasticsearch.curator.name" . }}
  labels: {{- include "elasticsearch.labels" . | nindent 4 }}
    role: curator
    component: elasticsearch-curator-configmap
rules:
  - apiGroups: [""]
    resources: ["configmaps"]
    verbs: ["update", "patch"]
  {{- if .Values.curator.psp.create }}
  - apiGroups: ["extensions"]
    resources: ["podsecuritypolicies"]
    verbs: ["use"]
    resourceNames:
      - {{ include "elasticsearch.curator.fullname" . }}
  {{- end }}
{{- end }}
