[postgresql] Support hostPath volume for archive mode

Also use DirectoryOrCreate type for hostPath volumes

Change-Id: Iad095ff945b8b95dd418249a1e657d48c8cd9926
This commit is contained in:
Vladimir Kozhukalov
2025-06-23 15:15:55 -05:00
parent 529f0a3dd7
commit d7b5bbdf62
4 changed files with 18 additions and 8 deletions

View File

@@ -279,10 +279,15 @@ spec:
- name: postgresql-data
hostPath:
path: {{ .Values.storage.host.host_path }}
type: DirectoryOrCreate
{{- if eq .Values.conf.postgresql.archive_mode "on" }}
- name: postgresql-archive
hostPath:
path: {{ .Values.storage.host.archive_host_path }}
type: DirectoryOrCreate
{{- end }}
{{- if or (eq .Values.conf.postgresql.archive_mode "on" ) (eq .Values.storage.pvc.enabled true) }}
{{- else }}
volumeClaimTemplates:
{{- if .Values.storage.pvc.enabled }}
- metadata:
name: postgresql-data
annotations:
@@ -292,7 +297,6 @@ spec:
resources:
requests:
storage: {{ .Values.storage.pvc.size }}
{{- end }}
{{- if eq .Values.conf.postgresql.archive_mode "on" }}
- metadata:
name: postgresql-archive

View File

@@ -181,6 +181,7 @@ storage:
class_path: volume.beta.kubernetes.io/storage-class
host:
host_path: /data/openstack-helm/postgresql
archive_host_path: /data/openstack-helm/postgresql-archive
mount:
path: /var/lib/postgresql
subpath: .

View File

@@ -0,0 +1,5 @@
---
postgresql:
- Add support of hostPath volume for archive mode
- Use DirectoryOrCreate type for hostPath volumes
...

View File

@@ -19,15 +19,15 @@ set -xe
: ${OSH_VALUES_OVERRIDES_PATH:="../openstack-helm/values_overrides"}
: ${OSH_EXTRA_HELM_ARGS:=""}
: ${OSH_EXTRA_HELM_ARGS_POSTGRESQL:="$(helm osh get-values-overrides -p ${OSH_VALUES_OVERRIDES_PATH} -c postgresql ${FEATURES})"}
: ${NAMESPACE:=openstack}
helm upgrade --install postgresql ${OSH_HELM_REPO}/postgresql \
--namespace=osh-infra \
--set monitoring.prometheus.enabled=true \
--set storage.pvc.size=1Gi \
--set storage.pvc.enabled=true \
--namespace=${NAMESPACE} \
${MONITORING_HELM_ARGS:="--set monitoring.prometheus.enabled=true"} \
--set pod.replicas.server=1 \
${VOLUME_HELM_ARGS:="--set storage.pvc.enabled=false --set storage.host.host_path=/tmp/postgresql-data --set conf.postgresql.archive_mode=off"} \
${OSH_EXTRA_HELM_ARGS} \
${OSH_EXTRA_HELM_ARGS_POSTGRESQL}
#NOTE: Wait for deploy
helm osh wait-for-pods osh-infra
helm osh wait-for-pods ${NAMESPACE}