{{- if and (.Values.metrics.enabled) (.Values.metrics.authProxy.enabled) -}} apiVersion: rbac.authorization.k8s.io/{{ .Values.rbac.apiVersion }} kind: ClusterRole metadata: labels: {{ include "externalip-webhook.labels" . | indent 4 }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} name: {{ template "externalip-webhook.fullname" . }}-proxy-role rules: - apiGroups: - authentication.k8s.io resources: - tokenreviews verbs: - create - apiGroups: - authorization.k8s.io resources: - subjectaccessreviews verbs: - create --- apiVersion: rbac.authorization.k8s.io/{{ .Values.rbac.apiVersion }} kind: ClusterRole metadata: labels: {{ include "externalip-webhook.labels" . | indent 4 }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} name: {{ template "externalip-webhook.fullname" . }}-metrics-reader rules: - nonResourceURLs: - /metrics verbs: - get {{- end -}}