{{- if .Values.rbac.enabled -}}
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  labels:
    app: {{ template "elasticsearch-curator.name" . }}
    chart: {{ template "elasticsearch-curator.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
    component: elasticsearch-curator-configmap
  name: {{ template "elasticsearch-curator.name" . }}-rolebinding
roleRef:
  kind: Role
  name: {{ template "elasticsearch-curator.name" . }}-role
  apiGroup: rbac.authorization.k8s.io
subjects:
  - kind: ServiceAccount
    name: {{ template "elasticsearch-curator.serviceAccountName" . }}
    namespace: {{ .Release.Namespace }}
{{- end -}}

