From 5969b84b6737a84e9f3aa2f91787e248c5f83d38 Mon Sep 17 00:00:00 2001 From: Maximilian Bischoff Date: Tue, 21 Sep 2021 22:43:36 +0200 Subject: [PATCH] [kube-state-metrics] Enable configuring kubernetes annotation metrics (#1362) * Enable configuring kubernetes annotation metrics With https://github.com/kubernetes/kube-state-metrics/pull/1468 kube-state-metrics v2.2.0 added the possibility to configure annotation metrics, similar to how label metrics are currently configured. This change adds a configuration option for configuring annotation metrics to this helm chart. Signed-off-by: Maximilian Bischoff * Bump chart version Signed-off-by: Maximilian Bischoff --- charts/kube-state-metrics/Chart.yaml | 2 +- charts/kube-state-metrics/templates/deployment.yaml | 3 +++ charts/kube-state-metrics/values.yaml | 9 +++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/charts/kube-state-metrics/Chart.yaml b/charts/kube-state-metrics/Chart.yaml index 95a506bb939..3ba37edaeda 100644 --- a/charts/kube-state-metrics/Chart.yaml +++ b/charts/kube-state-metrics/Chart.yaml @@ -7,7 +7,7 @@ keywords: - prometheus - kubernetes type: application -version: 3.5.0 +version: 3.5.1 appVersion: 2.2.0 home: https://github.com/kubernetes/kube-state-metrics/ sources: diff --git a/charts/kube-state-metrics/templates/deployment.yaml b/charts/kube-state-metrics/templates/deployment.yaml index a4c4c0b226b..d7afe45725b 100644 --- a/charts/kube-state-metrics/templates/deployment.yaml +++ b/charts/kube-state-metrics/templates/deployment.yaml @@ -77,6 +77,9 @@ spec: {{- if .Values.metricLabelsAllowlist }} - --metric-labels-allowlist={{ .Values.metricLabelsAllowlist | join "," }} {{- end }} + {{- if .Values.metricAnnotationsAllowList }} + - --metric-annotations-allowlist={{ .Values.metricAnnotationsAllowList | join "," }} + {{- end }} {{- if .Values.metricAllowlist }} - --metric-allowlist={{ .Values.metricAllowlist | join "," }} {{- end }} diff --git a/charts/kube-state-metrics/values.yaml b/charts/kube-state-metrics/values.yaml index 86e3d77ef78..72cdc8e8841 100644 --- a/charts/kube-state-metrics/values.yaml +++ b/charts/kube-state-metrics/values.yaml @@ -133,6 +133,15 @@ metricDenylist: [] metricLabelsAllowlist: [] # - namespaces=[k8s-label-1,k8s-label-n] +# Comma-separated list of Kubernetes annotations keys that will be used in the resource' +# labels metric. By default the metric contains only name and namespace labels. +# To include additional annotations provide a list of resource names in their plural form and Kubernetes +# annotation keys you would like to allow for them (Example: '=namespaces=[kubernetes.io/team,...],pods=[kubernetes.io/team],...)'. +# A single '*' can be provided per resource instead to allow any annotations, but that has +# severe performance implications (Example: '=pods=[*]'). +metricAnnotationsAllowList: [] + # - pods=[k8s-annotation-1,k8s-annotation-n] + # Available collectors for kube-state-metrics. # By default, all available resources are enabled, comment out to disable. collectors: