diff --git a/jsonnet/kube-prometheus/prometheus-adapter/prometheus-adapter.libsonnet b/jsonnet/kube-prometheus/prometheus-adapter/prometheus-adapter.libsonnet index 6d6604bc2ef7f11e30cfbccc9f40f7fa7b52bf69..b233625976c68cc005dd7965a1dce4d666cc6e28 100644 --- a/jsonnet/kube-prometheus/prometheus-adapter/prometheus-adapter.libsonnet +++ b/jsonnet/kube-prometheus/prometheus-adapter/prometheus-adapter.libsonnet @@ -184,6 +184,25 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; clusterRole.mixin.metadata.withName('resource-metrics-server-resources') + clusterRole.withRules(rules), + clusterRoleAggregatedMetricsReader: + local clusterRole = k.rbac.v1.clusterRole; + local policyRule = clusterRole.rulesType; + + local rules = + policyRule.new() + + policyRule.withApiGroups(['metrics.k8s.io']) + + policyRule.withResources(['pods']) + + policyRule.withVerbs(['get','list','watch']); + + clusterRole.new() + + clusterRole.mixin.metadata.withName('system:aggregated-metrics-reader') + + clusterRole.mixin.metadata.withLabels({ + "rbac.authorization.k8s.io/aggregate-to-admin": "true", + "rbac.authorization.k8s.io/aggregate-to-edit": "true", + "rbac.authorization.k8s.io/aggregate-to-view": "true", + }) + + clusterRole.withRules(rules), + roleBindingAuthReader: local roleBinding = k.rbac.v1.roleBinding;