From d9e11d1b8a074d17c033c58f6087863f90bf18f1 Mon Sep 17 00:00:00 2001 From: RouxAntoine Date: Wed, 3 May 2023 23:39:58 +0200 Subject: [PATCH 1/2] fix: use variable for pod readiness and liveness probe script --- .../spec/template/yaml/PrimaryStatefulSetTemplate.yaml | 4 ++-- .../spec/template/yaml/ReplicaStatefulSetTemplate.yaml | 4 ++-- controllers/spec/template/yaml/Templates.go | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/controllers/spec/template/yaml/PrimaryStatefulSetTemplate.yaml b/controllers/spec/template/yaml/PrimaryStatefulSetTemplate.yaml index 8e52ffb..eef6432 100644 --- a/controllers/spec/template/yaml/PrimaryStatefulSetTemplate.yaml +++ b/controllers/spec/template/yaml/PrimaryStatefulSetTemplate.yaml @@ -68,7 +68,7 @@ spec: command: - sh - -c - - exec pg_isready -U postgres -h $POD_IP + - exec pg_isready -U $POSTGRES_USER -h $POD_IP failureThreshold: 10 initialDelaySeconds: 60 periodSeconds: 20 @@ -80,7 +80,7 @@ spec: command: - sh - -c - - exec pg_isready -U postgres -h $POD_IP + - exec pg_isready -U $POSTGRES_USER -h $POD_IP failureThreshold: 3 initialDelaySeconds: 5 periodSeconds: 10 diff --git a/controllers/spec/template/yaml/ReplicaStatefulSetTemplate.yaml b/controllers/spec/template/yaml/ReplicaStatefulSetTemplate.yaml index cb4bbe9..4aa2ade 100644 --- a/controllers/spec/template/yaml/ReplicaStatefulSetTemplate.yaml +++ b/controllers/spec/template/yaml/ReplicaStatefulSetTemplate.yaml @@ -90,7 +90,7 @@ spec: command: - sh - -c - - exec pg_isready -U postgres -h $POD_IP + - exec pg_isready -U $POSTGRES_USER -h $POD_IP failureThreshold: 10 initialDelaySeconds: 60 periodSeconds: 20 @@ -102,7 +102,7 @@ spec: command: - sh - -c - - exec pg_isready -U postgres -h $POD_IP + - exec pg_isready -U $POSTGRES_USER -h $POD_IP failureThreshold: 3 initialDelaySeconds: 5 periodSeconds: 10 diff --git a/controllers/spec/template/yaml/Templates.go b/controllers/spec/template/yaml/Templates.go index 537a9f2..0459d10 100644 --- a/controllers/spec/template/yaml/Templates.go +++ b/controllers/spec/template/yaml/Templates.go @@ -405,7 +405,7 @@ spec: command: - sh - -c - - exec pg_isready -U postgres -h $POD_IP + - exec pg_isready -U $POSTGRES_USER -h $POD_IP failureThreshold: 10 initialDelaySeconds: 60 periodSeconds: 20 @@ -417,7 +417,7 @@ spec: command: - sh - -c - - exec pg_isready -U postgres -h $POD_IP + - exec pg_isready -U $POSTGRES_USER -h $POD_IP failureThreshold: 3 initialDelaySeconds: 5 periodSeconds: 10 @@ -553,7 +553,7 @@ spec: command: - sh - -c - - exec pg_isready -U postgres -h $POD_IP + - exec pg_isready -U $POSTGRES_USER -h $POD_IP failureThreshold: 10 initialDelaySeconds: 60 periodSeconds: 20 @@ -565,7 +565,7 @@ spec: command: - sh - -c - - exec pg_isready -U postgres -h $POD_IP + - exec pg_isready -U $POSTGRES_USER -h $POD_IP failureThreshold: 3 initialDelaySeconds: 5 periodSeconds: 10 From 80bbec5e89b685abd3503fa24e750476be45bc5e Mon Sep 17 00:00:00 2001 From: RouxAntoine Date: Thu, 11 May 2023 00:56:07 +0200 Subject: [PATCH 2/2] fix: use variable for backup script postgres user --- controllers/spec/template/yaml/BaseConfigMapTemplate.yaml | 4 ++-- controllers/spec/template/yaml/Templates.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/spec/template/yaml/BaseConfigMapTemplate.yaml b/controllers/spec/template/yaml/BaseConfigMapTemplate.yaml index 3e57b06..b2eaf2f 100644 --- a/controllers/spec/template/yaml/BaseConfigMapTemplate.yaml +++ b/controllers/spec/template/yaml/BaseConfigMapTemplate.yaml @@ -120,9 +120,9 @@ data: backUpFilePath="$BACKUP_DESTINATION_FOLDER/$backUpFileName" echo "$dt - Starting DB backup of Kubegres resource $KUBEGRES_RESOURCE_NAME into file: $backUpFilePath"; - echo "$dt - Running: pg_dumpall -h $BACKUP_SOURCE_DB_HOST_NAME -U postgres -c | gzip > $backUpFilePath" + echo "$dt - Running: pg_dumpall -h $BACKUP_SOURCE_DB_HOST_NAME -U $POSTGRES_USER -c | gzip > $backUpFilePath" - pg_dumpall -h $BACKUP_SOURCE_DB_HOST_NAME -U postgres -c | gzip > $backUpFilePath + pg_dumpall -h $BACKUP_SOURCE_DB_HOST_NAME -U $POSTGRES_USER -c | gzip > $backUpFilePath if [ $? -ne 0 ]; then rm $backUpFilePath diff --git a/controllers/spec/template/yaml/Templates.go b/controllers/spec/template/yaml/Templates.go index 0459d10..d3565f4 100644 --- a/controllers/spec/template/yaml/Templates.go +++ b/controllers/spec/template/yaml/Templates.go @@ -189,7 +189,7 @@ data: echo "$dt - Starting DB backup of Kubegres resource $KUBEGRES_RESOURCE_NAME into file: $backUpFilePath"; echo "$dt - Running: pg_dumpall -h $BACKUP_SOURCE_DB_HOST_NAME -U postgres -c | gzip > $backUpFilePath" - pg_dumpall -h $BACKUP_SOURCE_DB_HOST_NAME -U postgres -c | gzip > $backUpFilePath + pg_dumpall -h $BACKUP_SOURCE_DB_HOST_NAME -U $POSTGRES_USER -c | gzip > $backUpFilePath if [ $? -ne 0 ]; then rm $backUpFilePath