{{- if (.Values.global.rbac) -}}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: {{ printf "%s:drycc-monitor-telegraf" .Release.Namespace | quote }}
  labels:
    rbac.authorization.k8s.io/aggregate-view-telegraf-stats: "true"
    app: drycc-monitor-telegraf
    heritage: drycc
rules:
  - apiGroups: ["metrics.k8s.io"]
    resources: ["pods"]
    verbs: ["get", "list", "watch"]
  - apiGroups: [""]
    resources: ["pods", "persistentvolumes", "nodes", "nodes/proxy", "nodes/stats"]
    verbs: ["get", "list", "watch"]
{{- end -}}
