From cf6232c479159fa0c9a05fc77208b4ba9cc993cb Mon Sep 17 00:00:00 2001 From: Mark Eijsermans <mark.eijsermans@hootsuite.com> Date: Tue, 24 Jul 2018 16:28:04 -0700 Subject: [PATCH] adjust rbac apiGroups to support core workloads api apps/v1 --- .../kube-state-metrics/kube-state-metrics.libsonnet | 13 ++++++++++++- manifests/kube-state-metrics-clusterRole.yaml | 3 +++ manifests/kube-state-metrics-role.yaml | 9 +++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/jsonnet/kube-prometheus/kube-state-metrics/kube-state-metrics.libsonnet b/jsonnet/kube-prometheus/kube-state-metrics/kube-state-metrics.libsonnet index 2805fc9d..2152c65f 100644 --- a/jsonnet/kube-prometheus/kube-state-metrics/kube-state-metrics.libsonnet +++ b/jsonnet/kube-prometheus/kube-state-metrics/kube-state-metrics.libsonnet @@ -74,6 +74,9 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; policyRule.withApiGroups(['apps']) + policyRule.withResources([ 'statefulsets', + 'daemonsets', + 'deployments', + 'replicasets', ]) + policyRule.withVerbs(['list', 'watch']); @@ -222,7 +225,15 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; policyRule.withVerbs(['get', 'update']) + policyRule.withResourceNames(['kube-state-metrics']); - local rules = [coreRule, extensionsRule]; + local appsRule = policyRule.new() + + policyRule.withApiGroups(['apps']) + + policyRule.withResources([ + 'deployments', + ]) + + policyRule.withVerbs(['get', 'update']) + + policyRule.withResourceNames(['kube-state-metrics']); + + local rules = [coreRule, extensionsRule, appsRule]; role.new() + role.mixin.metadata.withName('kube-state-metrics') + diff --git a/manifests/kube-state-metrics-clusterRole.yaml b/manifests/kube-state-metrics-clusterRole.yaml index cae18483..c519a918 100644 --- a/manifests/kube-state-metrics-clusterRole.yaml +++ b/manifests/kube-state-metrics-clusterRole.yaml @@ -34,6 +34,9 @@ rules: - apps resources: - statefulsets + - daemonsets + - deployments + - replicasets verbs: - list - watch diff --git a/manifests/kube-state-metrics-role.yaml b/manifests/kube-state-metrics-role.yaml index 0063ffb4..e03d8898 100644 --- a/manifests/kube-state-metrics-role.yaml +++ b/manifests/kube-state-metrics-role.yaml @@ -19,3 +19,12 @@ rules: verbs: - get - update +- apiGroups: + - apps + resourceNames: + - kube-state-metrics + resources: + - deployments + verbs: + - get + - update -- GitLab