# helm_charts_rolebinding-patroni.yaml
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
  name: {{ template "patroni.fullname" . }}
  labels:
    app: {{ template "patroni.fullname" . }}
    chart: {{ template "patroni.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
subjects:
  - kind: ServiceAccount
    name: {{ template "patroni.serviceAccountName" . }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ template "patroni.fullname" . }}
{{- end }}