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