Merge branch '18278-GKE-fixes'
[arvados-k8s.git] / charts / arvados / templates / postgres-deployment.yaml
index 8462bb6d5e44ded48c3026bf0b589e1ca02e9e4e..2d7489f5bc439f201966e0f592a41f87634d179f 100644 (file)
@@ -3,7 +3,7 @@
 # SPDX-License-Identifier: Apache-2.0
 
 apiVersion: apps/v1
-kind: Deployment
+kind: StatefulSet
 metadata:
   name: "arvados-postgres"
   labels:
@@ -12,6 +12,9 @@ metadata:
     release: {{ .Release.Name }}
     heritage: {{ .Release.Service }}
 spec:
+  replicas: 1
+  podManagementPolicy: Parallel
+  serviceName: arvados-postgres
   selector:
     matchLabels:
       app: arvados-postgres
@@ -22,9 +25,10 @@ spec:
         app: arvados-postgres
         release: {{ .Release.Name }}
     spec:
+      terminationGracePeriodSeconds: 1
       containers:
         - name: {{ .Chart.Name }}
-          image: "postgres:9.5"
+          image: "postgres:10"
           imagePullPolicy: {{ .Values.image.pullPolicy }}
           env:
             - name: POSTGRES_HOST_AUTH_METHOD
@@ -35,7 +39,7 @@ spec:
               subPath: create_dbs.sh
             {{- if .Values.postgres.persistence.enabled }}
             - name: postgres-storage
-              mountPath: /var/lib/postgresql/data
+              mountPath: /var/lib/postgresql
             {{- end }}
       volumes:
         - name: postgres-configmap
@@ -46,3 +50,15 @@ spec:
           persistentVolumeClaim:
             claimName: {{ .Release.Name }}-postgres-pvc
         {{- end }}
+  {{- if .Values.postgres.persistence.enabled }}
+  volumeClaimTemplates:
+    - metadata:
+        name: postgres-storage
+      spec:
+        storageClassName: {{ .Values.postgres.persistence.storageClass }}
+        accessModes:
+          - ReadWriteOnce
+        resources:
+          requests:
+            storage: {{ .Values.postgres.persistence.size }}
+  {{- end }}