[prometheus] Support hostPath volumes

The same for prometheus-alertmanager

Change-Id: Ib2fd4d2468b69b478408e914693591f299bca89b
This commit is contained in:
Vladimir Kozhukalov
2025-06-23 15:19:26 -05:00
parent 529f0a3dd7
commit 398119e546
6 changed files with 23 additions and 0 deletions

View File

@@ -170,8 +170,15 @@ spec:
defaultMode: 0555
{{ if $mounts_alertmanager.volumes }}{{ toYaml $mounts_alertmanager.volumes | indent 8 }}{{ end }}
{{- if not .Values.storage.alertmanager.enabled }}
{{- if .Values.storage.alertmanager.use_local_path.enabled }}
- name: alertmanager-data
hostPath:
path: {{ .Values.storage.alertmanager.use_local_path.host_path }}
type: DirectoryOrCreate
{{- else }}
- name: alertmanager-data
emptyDir: {}
{{- end }}
{{- else }}
volumeClaimTemplates:
- metadata:

View File

@@ -224,6 +224,9 @@ storage:
requests:
storage: 5Gi
storage_class: general
use_local_path:
enabled: false
host_path: /var/lib/prometheus-alertmanager-data
manifests:
clusterrolebinding: true

View File

@@ -245,8 +245,15 @@ spec:
{{- end }}
{{ if $mounts_prometheus.volumes }}{{ toYaml $mounts_prometheus.volumes | indent 8 }}{{ end }}
{{- if not .Values.storage.enabled }}
{{- if .Values.storage.use_local_path.enabled }}
- name: storage
hostPath:
path: {{ .Values.storage.use_local_path.host_path }}
type: DirectoryOrCreate
{{- else }}
- name: storage
emptyDir: {}
{{- end }}
{{- else }}
volumeClaimTemplates:
- metadata:

View File

@@ -319,6 +319,9 @@ storage:
requests:
storage: 5Gi
storage_class: general
use_local_path:
enabled: false
host_path: /var/lib/prometheus-data
manifests:
certificates: false

View File

@@ -19,6 +19,7 @@ set -xe
#NOTE: Deploy command
helm upgrade --install prometheus-alertmanager ${OSH_HELM_REPO}/prometheus-alertmanager \
--namespace=osh-infra \
${VOLUME_HELM_ARGS:="--set storage.alertmanager.enabled=false --set storage.alertmanager.use_local_path.enabled=true"} \
--set pod.replicas.alertmanager=1
#NOTE: Wait for deploy

View File

@@ -19,9 +19,11 @@ set -xe
FEATURES="alertmanager ceph elasticsearch kubernetes nodes openstack postgresql apparmor ${FEATURES}"
: ${OSH_EXTRA_HELM_ARGS_PROMETHEUS:="$(helm osh get-values-overrides -p ${OSH_VALUES_OVERRIDES_PATH} -c prometheus ${FEATURES})"}
#NOTE: Deploy command
helm upgrade --install prometheus ${OSH_HELM_REPO}/prometheus \
--namespace=osh-infra \
${VOLUME_HELM_ARGS:="--set storage.enabled=false --set storage.use_local_path.enabled=true"} \
${OSH_EXTRA_HELM_ARGS:=} \
${OSH_EXTRA_HELM_ARGS_PROMETHEUS}