# helm_charts_controller-rolebinding.yaml
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  labels:
    app: {{ template "nginx-ingress.name" . }}
    chart: {{ template "nginx-ingress.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ template "nginx-ingress.releaseLabel" . }}
  name: {{ template "nginx-ingress.fullname" . }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ template "nginx-ingress.fullname" . }}
subjects:
  - kind: ServiceAccount
    name: {{ template "nginx-ingress.serviceAccountName" . }}
    namespace: {{ .Release.Namespace }}
{{- end -}}