diff --git a/chart/templates/statefulset-clickhouse.yaml b/chart/templates/statefulset-clickhouse.yaml index 57b22a9..0db9a16 100644 --- a/chart/templates/statefulset-clickhouse.yaml +++ b/chart/templates/statefulset-clickhouse.yaml @@ -1,10 +1,15 @@ apiVersion: apps/v1 kind: StatefulSet metadata: - name: {{ include "poeticmetric.fullname" . }}-clickhouse labels: {{ include "poeticmetric.labels" . | nindent 4 }} + name: {{ include "poeticmetric.fullname" . }}-clickhouse spec: + {{ if .Values.clickhouse.persistence.enabled }} + persistentVolumeClaimRetentionPolicy: + whenDeleted: Retain + whenScaled: Retain + {{ end }} replicas: 1 selector: matchLabels: @@ -43,8 +48,8 @@ spec: name: clickhouse resources: {{ toYaml .Values.clickhouse.resources | nindent 10 }} volumeMounts: - - name: configmap-clickhouse - mountPath: /etc/clickhouse-server/config.d/custom_config.xml + - mountPath: /etc/clickhouse-server/config.d/custom_config.xml + name: configmap-clickhouse subPath: CONFIG {{ if .Values.clickhouse.persistence.enabled }} - mountPath: /var/lib/clickhouse/ @@ -56,12 +61,9 @@ spec: name: {{ include "poeticmetric.fullname" . }}-clickhouse name: configmap-clickhouse {{ if .Values.clickhouse.persistence.enabled }} - persistentVolumeClaimRetentionPolicy: - whenDeleted: Retain - whenScaled: Retain volumeClaimTemplates: - - kind: PersistentVolumeClaim - apiVersion: v1 + - apiVersion: v1 + kind: PersistentVolumeClaim metadata: name: data spec: diff --git a/chart/templates/statefulset-postgres.yaml b/chart/templates/statefulset-postgres.yaml index e4501a3..6f98358 100644 --- a/chart/templates/statefulset-postgres.yaml +++ b/chart/templates/statefulset-postgres.yaml @@ -5,6 +5,11 @@ metadata: {{ include "poeticmetric.labels" . | nindent 4 }} name: {{ include "poeticmetric.fullname" . }}-postgres spec: + {{ if .Values.postgres.persistence.enabled }} + persistentVolumeClaimRetentionPolicy: + whenDeleted: Retain + whenScaled: Retain + {{ end }} replicas: 1 selector: matchLabels: @@ -42,17 +47,16 @@ spec: imagePullPolicy: {{ .Values.postgres.image.pullPolicy }} name: postgres resources: {{ toYaml .Values.postgres.resources | nindent 10 }} - {{ if .Values.postgres.persistence.enabled }} + {{ if .Values.postgres.persistence.enabled }} volumeMounts: - mountPath: /var/lib/postgresql/data name: data subPath: postgres - persistentVolumeClaimRetentionPolicy: - whenDeleted: Retain - whenScaled: Retain + {{ end }} + {{ if .Values.postgres.persistence.enabled }} volumeClaimTemplates: - - kind: PersistentVolumeClaim - apiVersion: v1 + - apiVersion: v1 + kind: PersistentVolumeClaim metadata: name: data spec: diff --git a/chart/templates/statefulset-redis.yaml b/chart/templates/statefulset-redis.yaml index b0d8fcf..bee7b9b 100644 --- a/chart/templates/statefulset-redis.yaml +++ b/chart/templates/statefulset-redis.yaml @@ -5,6 +5,11 @@ metadata: {{ include "poeticmetric.labels" . | nindent 4 }} name: {{ include "poeticmetric.fullname" . }}-redis spec: + {{ if .Values.redis.persistence.enabled }} + persistentVolumeClaimRetentionPolicy: + whenDeleted: Retain + whenScaled: Retain + {{ end }} replicas: 1 selector: matchLabels: @@ -36,9 +41,6 @@ spec: subPath: redis {{ end }} {{ if .Values.redis.persistence.enabled }} - persistentVolumeClaimRetentionPolicy: - whenDeleted: Retain - whenScaled: Retain volumeClaimTemplates: - kind: PersistentVolumeClaim apiVersion: v1