{{- if .Values.managedServiceAccount }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: {{ template "filebeat.serviceAccount" . }}-role
  labels:
    app: "{{ template "filebeat.fullname" . }}"
rules:
  - apiGroups:
      - coordination.k8s.io
    resources:
      - leases
    verbs: ["get", "create", "update"]
{{- end -}}
