Skip to content

Commit

Permalink
Refactor statefulset resources for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
th0th committed Nov 20, 2024
1 parent 0f59246 commit 1fe14c8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
18 changes: 10 additions & 8 deletions chart/templates/statefulset-clickhouse.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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/
Expand All @@ -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:
Expand Down
16 changes: 10 additions & 6 deletions chart/templates/statefulset-postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 5 additions & 3 deletions chart/templates/statefulset-redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -36,9 +41,6 @@ spec:
subPath: redis
{{ end }}
{{ if .Values.redis.persistence.enabled }}
persistentVolumeClaimRetentionPolicy:
whenDeleted: Retain
whenScaled: Retain
volumeClaimTemplates:
- kind: PersistentVolumeClaim
apiVersion: v1
Expand Down

0 comments on commit 1fe14c8

Please sign in to comment.