From d67d71c7f68cead06785f161f9397adf7c07811c Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Thu, 19 Dec 2024 17:23:58 +0100 Subject: [PATCH] [kube-prometheus-stack] Add alertmanager persistentVolumeClaimRetentionPolicy (#5078) Signed-off-by: Zadkiel AHARONIAN Signed-off-by: GitHub --- charts/kube-prometheus-stack/Chart.yaml | 2 +- .../templates/alertmanager/alertmanager.yaml | 4 ++++ charts/kube-prometheus-stack/values.yaml | 17 ++++++++++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/charts/kube-prometheus-stack/Chart.yaml b/charts/kube-prometheus-stack/Chart.yaml index bf11f82980ea..5e73c50e726b 100644 --- a/charts/kube-prometheus-stack/Chart.yaml +++ b/charts/kube-prometheus-stack/Chart.yaml @@ -23,7 +23,7 @@ name: kube-prometheus-stack sources: - https://github.com/prometheus-community/helm-charts - https://github.com/prometheus-operator/kube-prometheus -version: 67.3.1 +version: 67.4.0 appVersion: v0.79.2 kubeVersion: ">=1.19.0-0" home: https://github.com/prometheus-operator/kube-prometheus diff --git a/charts/kube-prometheus-stack/templates/alertmanager/alertmanager.yaml b/charts/kube-prometheus-stack/templates/alertmanager/alertmanager.yaml index 2705e83070a8..d3b553e9b626 100644 --- a/charts/kube-prometheus-stack/templates/alertmanager/alertmanager.yaml +++ b/charts/kube-prometheus-stack/templates/alertmanager/alertmanager.yaml @@ -101,6 +101,10 @@ spec: storage: {{ tpl (toYaml .Values.alertmanager.alertmanagerSpec.storage | indent 4) . }} {{- end }} +{{- with .Values.alertmanager.alertmanagerSpec.persistentVolumeClaimRetentionPolicy }} + persistentVolumeClaimRetentionPolicy: + {{- toYaml . | nindent 4 }} +{{- end }} {{- if .Values.alertmanager.alertmanagerSpec.podMetadata }} podMetadata: {{ toYaml .Values.alertmanager.alertmanagerSpec.podMetadata | indent 4 }} diff --git a/charts/kube-prometheus-stack/values.yaml b/charts/kube-prometheus-stack/values.yaml index 6efdb92023fb..2b6901679791 100644 --- a/charts/kube-prometheus-stack/values.yaml +++ b/charts/kube-prometheus-stack/values.yaml @@ -684,6 +684,16 @@ alertmanager: ## ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#alertmanagerspec ## alertmanagerSpec: + ## Statefulset's persistent volume claim retention policy + ## whenDeleted and whenScaled determine whether + ## statefulset's PVCs are deleted (true) or retained (false) + ## on scaling down and deleting statefulset, respectively. + ## Requires Kubernetes version 1.27.0+. + ## Ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention + persistentVolumeClaimRetentionPolicy: {} + # whenDeleted: Retain + # whenScaled: Retain + ## Standard object's metadata. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata ## Metadata Labels and Annotations gets propagated to the Alertmanager pods. ## @@ -3551,9 +3561,10 @@ prometheus: ## prometheusSpec: ## Statefulset's persistent volume claim retention policy - ## pvcDeleteOnStsDelete and pvcDeleteOnStsScale determine whether - ## statefulset's PVCs are deleted (true) or retained (false) on scaling down - ## and deleting statefulset, respectively. Requires 1.27.0+. + ## whenDeleted and whenScaled determine whether + ## statefulset's PVCs are deleted (true) or retained (false) + ## on scaling down and deleting statefulset, respectively. + ## Requires Kubernetes version 1.27.0+. ## Ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention persistentVolumeClaimRetentionPolicy: {} # whenDeleted: Retain