From: Mike Ludwig Date: Thu, 26 Nov 2020 00:16:58 +0000 (-0500) Subject: convert postgres to statefulset for persistence - credit ward@curii.com X-Git-Url: https://git.arvados.org/arvados-k8s.git/commitdiff_plain/078bff034636540debefe9c12f01a1443ec0d499 convert postgres to statefulset for persistence - credit ward@curii.com Arvados-DCO-1.1-Signed-off-by: Michael Ludwig --- diff --git a/charts/arvados/templates/postgres-deployment.yaml b/charts/arvados/templates/postgres-deployment.yaml index 8462bb6..d820e8e 100644 --- a/charts/arvados/templates/postgres-deployment.yaml +++ b/charts/arvados/templates/postgres-deployment.yaml @@ -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,6 +25,7 @@ spec: app: arvados-postgres release: {{ .Release.Name }} spec: + terminationGracePeriodSeconds: 1 containers: - name: {{ .Chart.Name }} image: "postgres:9.5" @@ -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 }} diff --git a/charts/arvados/templates/postgres-pvc.yaml b/charts/arvados/templates/postgres-pvc.yaml deleted file mode 100644 index 85bcbc2..0000000 --- a/charts/arvados/templates/postgres-pvc.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) The Arvados Authors. All rights reserved. -# -# SPDX-License-Identifier: Apache-2.0 - -{{- if .Values.postgres.persistence.enabled }} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ .Release.Name }}-postgres-pvc - labels: - app: {{ template "arvados.name" . }} - chart: {{ template "arvados.chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -spec: - storageClassName: {{ .Values.postgres.persistence.storageClass }} - accessModes: - - ReadWriteOnce - resources: - requests: - storage: {{ .Values.postgres.persistence.size }} -{{- end }} \ No newline at end of file