From 6b6cc630c6596549d07d4e3272dd7172c7ff3ee9 Mon Sep 17 00:00:00 2001 From: jerger Date: Sat, 2 Apr 2022 17:26:02 +0200 Subject: [PATCH] fix backup credentials --- src/main/resources/backup/cron.yaml | 25 +++++++++++++------ .../cljc/dda/c4k_nextcloud/backup_test.cljc | 21 ++++++++++++---- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/main/resources/backup/cron.yaml b/src/main/resources/backup/cron.yaml index 3c54570..df933c8 100644 --- a/src/main/resources/backup/cron.yaml +++ b/src/main/resources/backup/cron.yaml @@ -6,8 +6,8 @@ metadata: app.kubernetes.part-of: cloud spec: schedule: "10 23 * * *" - successfulJobsHistoryLimit: 0 - failedJobsHistoryLimit: 0 + successfulJobsHistoryLimit: 1 + failedJobsHistoryLimit: 1 jobTemplate: spec: template: @@ -18,12 +18,21 @@ spec: imagePullPolicy: IfNotPresent command: ["/entrypoint.sh"] env: - - name: POSTGRES_USER_FILE - value: /var/run/secrets/cloud-secrets/postgres-user - - name: POSTGRES_DB_FILE - value: /var/run/secrets/cloud-secrets/postgres-db - - name: POSTGRES_PASSWORD_FILE - value: /var/run/secrets/cloud-secrets/postgres-password + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: postgres-secret + key: postgres-user + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: postgres-secret + key: postgres-password + - name: POSTGRES_DB + valueFrom: + configMapKeyRef: + name: postgres-config + key: postgres-db - name: POSTGRES_HOST value: "postgresql-service:5432" - name: POSTGRES_SERVICE diff --git a/src/test/cljc/dda/c4k_nextcloud/backup_test.cljc b/src/test/cljc/dda/c4k_nextcloud/backup_test.cljc index 227c4d6..3eb79c9 100644 --- a/src/test/cljc/dda/c4k_nextcloud/backup_test.cljc +++ b/src/test/cljc/dda/c4k_nextcloud/backup_test.cljc @@ -30,8 +30,8 @@ :metadata {:name "cloud-backup", :labels {:app.kubernetes.part-of "cloud"}} :spec {:schedule "10 23 * * *" - :successfulJobsHistoryLimit 0 - :failedJobsHistoryLimit 0 + :successfulJobsHistoryLimit 1 + :failedJobsHistoryLimit 1 :jobTemplate {:spec {:template @@ -42,9 +42,20 @@ :imagePullPolicy "IfNotPresent" :command ["/entrypoint.sh"] :env - [{:name "POSTGRES_USER_FILE", :value "/var/run/secrets/cloud-secrets/postgres-user"} - {:name "POSTGRES_DB_FILE", :value "/var/run/secrets/cloud-secrets/postgres-db"} - {:name "POSTGRES_PASSWORD_FILE", :value "/var/run/secrets/cloud-secrets/postgres-password"} + [{:valueFrom + {:secretKeyRef + {:name "postgres-secret", + :key "postgres-user"}}, + :name "POSTGRES_USER"} + {:valueFrom + {:secretKeyRef + {:name "postgres-secret", + :key "postgres-password"}}, + :name "POSTGRES_PASSWORD"} + {:valueFrom + {:configMapKeyRef + {:name "postgres-config", :key "postgres-db"}}, + :name "POSTGRES_DB"} {:name "POSTGRES_HOST", :value "postgresql-service:5432"} {:name "POSTGRES_SERVICE", :value "postgresql-service"} {:name "POSTGRES_PORT", :value "5432"}