From 7235a4c7549937301f52acc305c98b96c4f1f3b0 Mon Sep 17 00:00:00 2001 From: Qiu Yu Date: Wed, 21 Oct 2020 13:35:14 -0700 Subject: [PATCH] [prometheus] Make emptyDir settings consistent across components (#243) Currently only prometheus server takes `emptyDir.sizeLimit` for `deployment` but not for `statefulset`. And alertmanager has no notion about `emptyDir.sizeLimit` at all. This change fixes that by following existing pattern of prometheus server deployment spec, to allow `sizeLimit` to be set for both `server` and `alertmanager`, regardless it is a deployment spec or statefulset. On the pushgateway side, existing comment string in `values.yaml` suggests if `persistentVolume.enabled` set to false, `emptyDir` will be used. But that's actually not the case. Since the existing pushgateway deployment spec by default has persistent volume turned off and doesn't specify emptyDir at all (neither in volume nor volumeMount), this change fixes the inconsistency by updating the comment string in values.yaml Signed-off-by: Qiu Yu Signed-off-by: Torsten Walter --- charts/prometheus/Chart.yaml | 2 +- charts/prometheus/templates/alertmanager/deploy.yaml | 7 ++++++- charts/prometheus/templates/alertmanager/sts.yaml | 7 ++++++- charts/prometheus/templates/server/sts.yaml | 7 ++++++- charts/prometheus/values.yaml | 8 +++++++- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/charts/prometheus/Chart.yaml b/charts/prometheus/Chart.yaml index 11129648..38f307bb 100644 --- a/charts/prometheus/Chart.yaml +++ b/charts/prometheus/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: prometheus -version: 11.16.3 +version: 11.16.4 appVersion: 2.21.0 description: Prometheus is a monitoring system and time series database. home: https://prometheus.io/ diff --git a/charts/prometheus/templates/alertmanager/deploy.yaml b/charts/prometheus/templates/alertmanager/deploy.yaml index 7a10af48..22c777f6 100644 --- a/charts/prometheus/templates/alertmanager/deploy.yaml +++ b/charts/prometheus/templates/alertmanager/deploy.yaml @@ -144,6 +144,11 @@ spec: persistentVolumeClaim: claimName: {{ if .Values.alertmanager.persistentVolume.existingClaim }}{{ .Values.alertmanager.persistentVolume.existingClaim }}{{- else }}{{ template "prometheus.alertmanager.fullname" . }}{{- end }} {{- else }} - emptyDir: {} + emptyDir: + {{- if .Values.alertmanager.emptyDir.sizeLimit }} + sizeLimit: {{ .Values.alertmanager.emptyDir.sizeLimit }} + {{- else }} + {} + {{- end -}} {{- end -}} {{- end }} diff --git a/charts/prometheus/templates/alertmanager/sts.yaml b/charts/prometheus/templates/alertmanager/sts.yaml index 74a9d957..c9a62cab 100644 --- a/charts/prometheus/templates/alertmanager/sts.yaml +++ b/charts/prometheus/templates/alertmanager/sts.yaml @@ -168,6 +168,11 @@ spec: {{- end }} {{- else }} - name: storage-volume - emptyDir: {} + emptyDir: + {{- if .Values.alertmanager.emptyDir.sizeLimit }} + sizeLimit: {{ .Values.alertmanager.emptyDir.sizeLimit }} + {{- else }} + {} + {{- end -}} {{- end }} {{- end }} diff --git a/charts/prometheus/templates/server/sts.yaml b/charts/prometheus/templates/server/sts.yaml index 20645c5f..cc0bd861 100644 --- a/charts/prometheus/templates/server/sts.yaml +++ b/charts/prometheus/templates/server/sts.yaml @@ -234,7 +234,12 @@ spec: {{- end }} {{- else }} - name: storage-volume - emptyDir: {} + emptyDir: + {{- if .Values.server.emptyDir.sizeLimit }} + sizeLimit: {{ .Values.server.emptyDir.sizeLimit }} + {{- else }} + {} + {{- end -}} {{- end }} {{- end }} {{- end }} diff --git a/charts/prometheus/values.yaml b/charts/prometheus/values.yaml index 193542b5..25bf6c71 100644 --- a/charts/prometheus/values.yaml +++ b/charts/prometheus/values.yaml @@ -224,6 +224,11 @@ alertmanager: ## subPath: "" + emptyDir: + ## alertmanager emptyDir volume size limit + ## + sizeLimit: "" + ## Annotations to be added to alertmanager pods ## podAnnotations: {} @@ -821,6 +826,8 @@ server: subPath: "" emptyDir: + ## Prometheus server emptyDir volume size limit + ## sizeLimit: "" ## Annotations to be added to Prometheus server pods @@ -1114,7 +1121,6 @@ pushgateway: persistentVolume: ## If true, pushgateway will create/use a Persistent Volume Claim - ## If false, use emptyDir ## enabled: false