64 lines
2.0 KiB
YAML
64 lines
2.0 KiB
YAML
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ include "thermo.fullname" . }}-postgres
|
|
labels:
|
|
{{- include "thermo.labels" . | nindent 4 }}
|
|
spec:
|
|
serviceName: {{ include "thermo.fullname" . }}-postgres
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
{{- include "thermo.postgresSelectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "thermo.postgresSelectorLabels" . | nindent 8 }}
|
|
spec:
|
|
securityContext:
|
|
fsGroup: 70
|
|
fsGroupChangePolicy: OnRootMismatch
|
|
containers:
|
|
- name: postgres
|
|
image: "{{ .Values.postgres.image.repository }}:{{ .Values.postgres.image.tag }}"
|
|
imagePullPolicy: {{ .Values.postgres.image.pullPolicy }}
|
|
ports:
|
|
- name: postgres
|
|
containerPort: 5432
|
|
envFrom:
|
|
- secretRef:
|
|
name: {{ include "thermo.fullname" . }}-postgres-secret
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /var/lib/postgresql/data
|
|
- name: init
|
|
mountPath: /docker-entrypoint-initdb.d
|
|
readOnly: true
|
|
readinessProbe:
|
|
exec:
|
|
command: ["sh", "-ec", "pg_isready -d \"$POSTGRES_DB\" -U \"$POSTGRES_USER\""]
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
livenessProbe:
|
|
exec:
|
|
command: ["sh", "-ec", "pg_isready -d \"$POSTGRES_DB\" -U \"$POSTGRES_USER\""]
|
|
initialDelaySeconds: 20
|
|
periodSeconds: 10
|
|
resources:
|
|
{{- toYaml .Values.postgres.resources | nindent 12 }}
|
|
volumes:
|
|
- name: init
|
|
configMap:
|
|
name: {{ include "thermo.fullname" . }}-postgres-init
|
|
defaultMode: 0555
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: data
|
|
spec:
|
|
storageClassName: {{ .Values.postgres.storage.className }}
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: {{ .Values.postgres.storage.size }}
|