From e0c1e37f99ef2ec8d1460ac9144fa1587b726c60 Mon Sep 17 00:00:00 2001 From: Simon Kienzler Date: Fri, 26 Jul 2024 06:34:15 +0200 Subject: [PATCH] [kube-state-metrics] Allow configuration of startupProbe (#4740) Signed-off-by: Simon Kienzler Signed-off-by: David Calvert Co-authored-by: David Calvert --- charts/kube-state-metrics/Chart.yaml | 2 +- .../templates/deployment.yaml | 20 +++++++++++++++++++ charts/kube-state-metrics/values.yaml | 17 ++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/charts/kube-state-metrics/Chart.yaml b/charts/kube-state-metrics/Chart.yaml index f33b075b7a14..371abd7572ba 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.22.1 +version: 5.23.0 appVersion: 2.13.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 b1a25b321f8e..f851ee77c2ff 100644 --- a/charts/kube-state-metrics/templates/deployment.yaml +++ b/charts/kube-state-metrics/templates/deployment.yaml @@ -147,6 +147,26 @@ spec: name: "metrics" {{- end }} {{- end }} + {{- if .Values.startupProbe.enabled }} + startupProbe: + failureThreshold: {{ .Values.startupProbe.failureThreshold }} + httpGet: + {{- if .Values.hostNetwork }} + host: 127.0.0.1 + {{- end }} + httpHeaders: + {{- range $_, $header := .Values.startupProbe.httpGet.httpHeaders }} + - name: {{ $header.name }} + value: {{ $header.value }} + {{- end }} + path: /livez + port: {{ $servicePort }} + scheme: {{ upper .Values.startupProbe.httpGet.scheme }} + initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.startupProbe.periodSeconds }} + successThreshold: {{ .Values.startupProbe.successThreshold }} + timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds }} + {{- end }} livenessProbe: failureThreshold: {{ .Values.livenessProbe.failureThreshold }} httpGet: diff --git a/charts/kube-state-metrics/values.yaml b/charts/kube-state-metrics/values.yaml index 2a9781138add..0910663f6cdb 100644 --- a/charts/kube-state-metrics/values.yaml +++ b/charts/kube-state-metrics/values.yaml @@ -497,6 +497,23 @@ initContainers: [] # - name: crd-sidecar # image: kiwigrid/k8s-sidecar:latest +## Settings for startup, liveness and readiness probes +## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ +## + +## Startup probe can optionally be enabled. +## +startupProbe: + enabled: false + failureThreshold: 3 + httpGet: + httpHeaders: [] + scheme: http + initialDelaySeconds: 0 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + ## Liveness probe ## livenessProbe: