{{- if and .Values.reloader.watchGlobally (.Values.reloader.rbac.enabled) }} {{- if (.Capabilities.APIVersions.Has "rbac.authorization.k8s.io/v1") }} apiVersion: rbac.authorization.k8s.io/v1 {{ else }} apiVersion: rbac.authorization.k8s.io/v1beta1 {{- end }} kind: ClusterRoleBinding metadata: annotations: {{ include "reloader-helm3.annotations" . | indent 4 }} labels: {{ include "reloader-labels.chart" . | indent 4 }} {{- if .Values.reloader.rbac.labels }} {{ tpl (toYaml .Values.reloader.rbac.labels) . | indent 4 }} {{- end }} {{- if .Values.reloader.matchLabels }} {{ tpl (toYaml .Values.reloader.matchLabels) . | indent 4 }} {{- end }} name: {{ template "reloader-fullname" . }}-role-binding roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: {{ template "reloader-fullname" . }}-role subjects: - kind: ServiceAccount name: {{ template "reloader-serviceAccountName" . }} namespace: {{ .Values.namespace | default .Release.Namespace }} {{- end }}