{{/* This file is based on https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/rbac-crd.md */}} {{- if and .Values.global.rbac.create .Values.global.rbac.createAggregateClusterRoles }} kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ template "kube-prometheus-stack.fullname" . }}-prometheus-crd-view labels: rbac.authorization.k8s.io/aggregate-to-admin: "true" rbac.authorization.k8s.io/aggregate-to-edit: "true" rbac.authorization.k8s.io/aggregate-to-view: "true" app: {{ template "kube-prometheus-stack.name" . }}-operator {{- include "kube-prometheus-stack.labels" . | nindent 4 }} rules: - apiGroups: ["monitoring.coreos.com"] resources: ["alertmanagers", "alertmanagerconfigs", "prometheuses", "prometheusrules", "servicemonitors", "podmonitors", "probes"] verbs: ["get", "list", "watch"] --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ template "kube-prometheus-stack.fullname" . }}-prometheus-crd-edit labels: rbac.authorization.k8s.io/aggregate-to-edit: "true" rbac.authorization.k8s.io/aggregate-to-admin: "true" app: {{ template "kube-prometheus-stack.name" . }}-operator {{- include "kube-prometheus-stack.labels" . | nindent 4 }} rules: - apiGroups: ["monitoring.coreos.com"] resources: ["alertmanagers", "alertmanagerconfigs", "prometheuses", "prometheusrules", "servicemonitors", "podmonitors", "probes"] verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] {{- end }}