From 770b060bbc84947157960e731286274e1cb1d9f2 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Mon, 14 Dec 2020 19:37:53 +0500 Subject: [PATCH] Add helper function for postgres name --- test/nextcloud/1.1.0/templates/_postgres.tpl | 4 ++++ test/nextcloud/1.1.0/templates/backup-postgres-hook.yaml | 2 +- test/nextcloud/1.1.0/templates/deployment.yaml | 2 +- test/nextcloud/1.1.0/templates/postgres-deployment.yaml | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test/nextcloud/1.1.0/templates/_postgres.tpl b/test/nextcloud/1.1.0/templates/_postgres.tpl index 8889f105714..038a680c802 100644 --- a/test/nextcloud/1.1.0/templates/_postgres.tpl +++ b/test/nextcloud/1.1.0/templates/_postgres.tpl @@ -13,6 +13,10 @@ app.kubernetes.io/name: {{ include "nextcloud.name" . }}-postgres app.kubernetes.io/instance: {{ .Release.Name }}-postgres {{- end }} +{{- define "postgres.imageName" -}} +{{- print "postgres:13.1" -}} +{{- end -}} + {{/* Retrieve postgres backup name This will return a unique name based on revision and chart numbers specified. diff --git a/test/nextcloud/1.1.0/templates/backup-postgres-hook.yaml b/test/nextcloud/1.1.0/templates/backup-postgres-hook.yaml index 5601f8b089c..3f6c6dc3662 100644 --- a/test/nextcloud/1.1.0/templates/backup-postgres-hook.yaml +++ b/test/nextcloud/1.1.0/templates/backup-postgres-hook.yaml @@ -17,7 +17,7 @@ spec: serviceAccountName: "{{ template "nextcloud.serviceAccountName" . }}" containers: - name: {{ .Chart.Name }}-postgres-backup - image: "postgres:13.1" + image: {{ template "postgres.imageName" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: POSTGRES_USER diff --git a/test/nextcloud/1.1.0/templates/deployment.yaml b/test/nextcloud/1.1.0/templates/deployment.yaml index ee58ab34c48..a4cfd7c2d7a 100644 --- a/test/nextcloud/1.1.0/templates/deployment.yaml +++ b/test/nextcloud/1.1.0/templates/deployment.yaml @@ -38,7 +38,7 @@ spec: {{- end }} initContainers: - name: init-postgresdb - image: "postgres:13.1" + image: {{ template "postgres.imageName" . }} command: ['sh', '-c', "until pg_isready -h {{ template "nextcloud.fullname" . }}-postgres; do echo waiting for postgres; sleep 2; done"] imagePullPolicy: {{ .Values.image.pullPolicy }} containers: diff --git a/test/nextcloud/1.1.0/templates/postgres-deployment.yaml b/test/nextcloud/1.1.0/templates/postgres-deployment.yaml index da39a2cd76d..47ce9363394 100644 --- a/test/nextcloud/1.1.0/templates/postgres-deployment.yaml +++ b/test/nextcloud/1.1.0/templates/postgres-deployment.yaml @@ -25,7 +25,7 @@ spec: spec: containers: - name: {{ .Chart.Name }}-postgres - image: "postgres:13.1" + image: {{ template "postgres.imageName" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: POSTGRES_USER