{{- if and .Values.rbac.create (not .Values.rbac.namespaced) }} kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ template "vmalert.server.fullname" . }}-clusterrolebinding namespace: {{ .Release.Namespace }} labels: {{- include "vmalert.server.labels" . | nindent 4 }} {{- with .Values.rbac.extraLabels }} {{ toYaml . | indent 4}} {{- end }} {{- with .Values.rbac.annotations }} annotations: {{ toYaml . | indent 4 }} {{- end }} subjects: - kind: ServiceAccount name: {{ include "vmalert.serviceAccountName" . }} namespace: {{ .Release.Namespace }} roleRef: kind: ClusterRole name: {{ template "vmalert.server.fullname" . }}-clusterrole apiGroup: rbac.authorization.k8s.io {{- end -}}