
{{- if .Values.podSecurityPolicy.enabled }}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
  name: {{ template "fluentd-elasticsearch.fullname" . }}
  labels:
    app.kubernetes.io/name: {{ include "fluentd-elasticsearch.name" . }}
    helm.sh/chart: {{ include "fluentd-elasticsearch.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile
roleRef:
  kind: Role
  name: {{ template "fluentd-elasticsearch.fullname" . }}
  apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
  name: {{ template "fluentd-elasticsearch.fullname" . }}
  namespace: {{ .Release.Namespace }}
{{- end }}
