From e8020a5701c3be72499e8afa20761000dbecaeb9 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Wed, 4 Oct 2023 20:42:57 +0200 Subject: [PATCH] [kube-state-metrics] add option to add initContainers and additional sidecars (#3861) Signed-off-by: Christian Schlotter --- charts/kube-state-metrics/Chart.yaml | 2 +- charts/kube-state-metrics/templates/deployment.yaml | 7 +++++++ charts/kube-state-metrics/values.yaml | 10 ++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/charts/kube-state-metrics/Chart.yaml b/charts/kube-state-metrics/Chart.yaml index 5c997ed0b501..9e2ceb26837c 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: 5.13.0 +version: 5.14.0 appVersion: 2.10.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 69a387a8cd30..2aedc92016a0 100644 --- a/charts/kube-state-metrics/templates/deployment.yaml +++ b/charts/kube-state-metrics/templates/deployment.yaml @@ -44,6 +44,10 @@ spec: {{- if .Values.priorityClassName }} priorityClassName: {{ .Values.priorityClassName }} {{- end }} + {{- with .Values.initContainers }} + initContainers: + {{- toYaml . | nindent 6 }} + {{- end }} containers: {{- $httpPort := ternary 9090 (.Values.service.port | default 8080) .Values.kubeRBACProxy.enabled}} {{- $telemetryPort := ternary 9091 (.Values.selfMonitor.telemetryPort | default 8081) .Values.kubeRBACProxy.enabled}} @@ -240,6 +244,9 @@ spec: {{- end }} {{- end }} {{- end }} + {{- with .Values.containers }} + {{- toYaml . | nindent 6 }} + {{- end }} {{- if or .Values.imagePullSecrets .Values.global.imagePullSecrets }} imagePullSecrets: {{- include "kube-state-metrics.imagePullSecrets" (dict "Values" .Values "imagePullSecrets" .Values.imagePullSecrets) | indent 8 }} diff --git a/charts/kube-state-metrics/values.yaml b/charts/kube-state-metrics/values.yaml index 29f59524d769..0821a7709e56 100644 --- a/charts/kube-state-metrics/values.yaml +++ b/charts/kube-state-metrics/values.yaml @@ -442,3 +442,13 @@ extraManifests: [] # name: prometheus-extra # data: # extra-data: "value" + +## Containers allows injecting additional containers. +containers: [] + # - name: crd-init + # image: kiwigrid/k8s-sidecar:latest + +## InitContainers allows injecting additional initContainers. +initContainers: [] + # - name: crd-sidecar + # image: kiwigrid/k8s-sidecar:latest