{{- if and .Values.autosharding.enabled .Values.rbac.create -}} apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: stsdiscovery-{{ template "kube-state-metrics.fullname" . }} namespace: {{ template "kube-state-metrics.namespace" . }} labels: {{- include "kube-state-metrics.labels" . | indent 4 }} rules: - apiGroups: - "" resources: - pods verbs: - get - apiGroups: - apps resourceNames: - {{ template "kube-state-metrics.fullname" . }} resources: - statefulsets verbs: - get - list - watch {{- end }}