Skip to content
Snippets Groups Projects
Commit 7d6183a9 authored by Matthias Loibl's avatar Matthias Loibl Committed by Lili Cosic
Browse files

jsonnet/kube-prometheus/kube-state-metrics: Move rules into array

parent 2f1083be
No related branches found
No related tags found
No related merge requests found
...@@ -43,7 +43,8 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet'; ...@@ -43,7 +43,8 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
local clusterRole = k.rbac.v1.clusterRole; local clusterRole = k.rbac.v1.clusterRole;
local rulesType = clusterRole.rulesType; local rulesType = clusterRole.rulesType;
local coreRule = rulesType.new() + local rules = [
rulesType.new() +
rulesType.withApiGroups(['']) + rulesType.withApiGroups(['']) +
rulesType.withResources([ rulesType.withResources([
'configmaps', 'configmaps',
...@@ -59,9 +60,9 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet'; ...@@ -59,9 +60,9 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
'namespaces', 'namespaces',
'endpoints', 'endpoints',
]) + ]) +
rulesType.withVerbs(['list', 'watch']); rulesType.withVerbs(['list', 'watch']),
local extensionsRule = rulesType.new() + rulesType.new() +
rulesType.withApiGroups(['extensions']) + rulesType.withApiGroups(['extensions']) +
rulesType.withResources([ rulesType.withResources([
'daemonsets', 'daemonsets',
...@@ -69,9 +70,9 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet'; ...@@ -69,9 +70,9 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
'replicasets', 'replicasets',
'ingresses', 'ingresses',
]) + ]) +
rulesType.withVerbs(['list', 'watch']); rulesType.withVerbs(['list', 'watch']),
local appsRule = rulesType.new() + rulesType.new() +
rulesType.withApiGroups(['apps']) + rulesType.withApiGroups(['apps']) +
rulesType.withResources([ rulesType.withResources([
'statefulsets', 'statefulsets',
...@@ -79,52 +80,52 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet'; ...@@ -79,52 +80,52 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
'deployments', 'deployments',
'replicasets', 'replicasets',
]) + ]) +
rulesType.withVerbs(['list', 'watch']); rulesType.withVerbs(['list', 'watch']),
local batchRule = rulesType.new() + rulesType.new() +
rulesType.withApiGroups(['batch']) + rulesType.withApiGroups(['batch']) +
rulesType.withResources([ rulesType.withResources([
'cronjobs', 'cronjobs',
'jobs', 'jobs',
]) + ]) +
rulesType.withVerbs(['list', 'watch']); rulesType.withVerbs(['list', 'watch']),
local autoscalingRule = rulesType.new() + rulesType.new() +
rulesType.withApiGroups(['autoscaling']) + rulesType.withApiGroups(['autoscaling']) +
rulesType.withResources([ rulesType.withResources([
'horizontalpodautoscalers', 'horizontalpodautoscalers',
]) + ]) +
rulesType.withVerbs(['list', 'watch']); rulesType.withVerbs(['list', 'watch']),
local authenticationRole = rulesType.new() + rulesType.new() +
rulesType.withApiGroups(['authentication.k8s.io']) + rulesType.withApiGroups(['authentication.k8s.io']) +
rulesType.withResources([ rulesType.withResources([
'tokenreviews', 'tokenreviews',
]) + ]) +
rulesType.withVerbs(['create']); rulesType.withVerbs(['create']),
local authorizationRole = rulesType.new() + rulesType.new() +
rulesType.withApiGroups(['authorization.k8s.io']) + rulesType.withApiGroups(['authorization.k8s.io']) +
rulesType.withResources([ rulesType.withResources([
'subjectaccessreviews', 'subjectaccessreviews',
]) + ]) +
rulesType.withVerbs(['create']); rulesType.withVerbs(['create']),
local policyRule = rulesType.new() + rulesType.new() +
rulesType.withApiGroups(['policy']) + rulesType.withApiGroups(['policy']) +
rulesType.withResources([ rulesType.withResources([
'poddisruptionbudgets', 'poddisruptionbudgets',
]) + ]) +
rulesType.withVerbs(['list', 'watch']); rulesType.withVerbs(['list', 'watch']),
local certificateRule = rulesType.new() + rulesType.new() +
rulesType.withApiGroups(['certificates.k8s.io']) + rulesType.withApiGroups(['certificates.k8s.io']) +
rulesType.withResources([ rulesType.withResources([
'certificatesigningrequests', 'certificatesigningrequests',
]) + ]) +
rulesType.withVerbs(['list', 'watch']); rulesType.withVerbs(['list', 'watch']),
local rules = [coreRule, extensionsRule, appsRule, batchRule, autoscalingRule, authenticationRole, authorizationRole, policyRule, certificateRule]; ];
clusterRole.new() + clusterRole.new() +
clusterRole.mixin.metadata.withName('kube-state-metrics') + clusterRole.mixin.metadata.withName('kube-state-metrics') +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment