From 7b4268f9af5d5efb31ccb9f04c1fc03fbf77aa2b Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Fri, 24 Feb 2023 09:36:07 +0100 Subject: [PATCH] split cnpg test and improve cnpg wait verbosity --- .github/workflows/common_library_tests.yaml | 2 + library/common-test/ci/cnpg-multi-values.yaml | 115 ++++++++++++++++++ library/common-test/ci/cnpg-values.yaml | 56 --------- .../templates/lib/dependencies/_dbWait.tpl | 3 + 4 files changed, 120 insertions(+), 56 deletions(-) create mode 100644 library/common-test/ci/cnpg-multi-values.yaml diff --git a/.github/workflows/common_library_tests.yaml b/.github/workflows/common_library_tests.yaml index 3e892970..e1f35ffc 100644 --- a/.github/workflows/common_library_tests.yaml +++ b/.github/workflows/common_library_tests.yaml @@ -128,6 +128,7 @@ jobs: - netshoot-values.yaml - metrics-values.yaml - cnpg-values.yaml + - cnpg-multi-values.yaml - manifest-values.yaml - stagingmanifest-values.yaml @@ -252,6 +253,7 @@ jobs: # - netshoot-values.yaml - metrics-values.yaml - cnpg-values.yaml + - cnpg-multi-values.yaml - manifest-values.yaml - stagingmanifest-values.yaml - vpn-gluetun-values.yaml diff --git a/library/common-test/ci/cnpg-multi-values.yaml b/library/common-test/ci/cnpg-multi-values.yaml new file mode 100644 index 00000000..b9a603d0 --- /dev/null +++ b/library/common-test/ci/cnpg-multi-values.yaml @@ -0,0 +1,115 @@ +service: + main: + enabled: true + ports: + main: + enabled: true + port: 8080 + +workload: + main: + enabled: true + podSpec: + containers: + main: + enabled: true + args: + - --port + - "8080" + probes: + liveness: + enabled: true + readiness: + enabled: true + startup: + enabled: true + +manifestManager: + enabled: true + staging: true + +cnpg: + main: + enabled: true + # -- number of instances for both postgres and pgbouncer + instances: 2 + database: "app" + user: "app" + # password: + # superUserPassword: + # -- change to supervised to disable unsupervised updates + # Example of rolling update strategy: + # - unsupervised: automated update of the primary once all + # replicas have been upgraded (default) + # - supervised: requires manual supervision to perform + # the switchover of the primary + primaryUpdateStrategy: unsupervised + # -- enable to create extra pgbouncer for readonly access + acceptRO: false + # -- storage size for the two pvc's per instance + storage: + size: "256Gi" + walsize: "256Gi" + pooler: + instances: 2 + # -- set to enable prometheus metrics + monitoring: + enablePodMonitor: false + # -- contains credentials and urls output by generator + creds: {} + ro: + enabled: true + # -- number of instances for both postgres and pgbouncer + instances: 2 + database: "app2" + user: "app2" + # password: + # superUserPassword: + # -- change to supervised to disable unsupervised updates + # Example of rolling update strategy: + # - unsupervised: automated update of the primary once all + # replicas have been upgraded (default) + # - supervised: requires manual supervision to perform + # the switchover of the primary + primaryUpdateStrategy: unsupervised + # -- enable to create extra pgbouncer for readonly access + acceptRO: true + # -- storage size for the two pvc's per instance + storage: + size: "256Gi" + walsize: "256Gi" + pooler: + instances: 2 + # -- set to enable prometheus metrics + monitoring: + enablePodMonitor: false + # -- contains credentials and urls output by generator + creds: {} + mon: + enabled: true + # -- number of instances for both postgres and pgbouncer + instances: 2 + database: "app2" + user: "app2" + # password: + # superUserPassword: + # -- change to supervised to disable unsupervised updates + # Example of rolling update strategy: + # - unsupervised: automated update of the primary once all + # replicas have been upgraded (default) + # - supervised: requires manual supervision to perform + # the switchover of the primary + primaryUpdateStrategy: unsupervised + # -- enable to create extra pgbouncer for readonly access + acceptRO: true + # -- storage size for the two pvc's per instance + storage: + size: "256Gi" + walsize: "256Gi" + pooler: + instances: 2 + # -- set to enable prometheus metrics + monitoring: + enablePodMonitor: true + # -- contains credentials and urls output by generator + creds: {} diff --git a/library/common-test/ci/cnpg-values.yaml b/library/common-test/ci/cnpg-values.yaml index b9a603d0..90f597c1 100644 --- a/library/common-test/ci/cnpg-values.yaml +++ b/library/common-test/ci/cnpg-values.yaml @@ -57,59 +57,3 @@ cnpg: enablePodMonitor: false # -- contains credentials and urls output by generator creds: {} - ro: - enabled: true - # -- number of instances for both postgres and pgbouncer - instances: 2 - database: "app2" - user: "app2" - # password: - # superUserPassword: - # -- change to supervised to disable unsupervised updates - # Example of rolling update strategy: - # - unsupervised: automated update of the primary once all - # replicas have been upgraded (default) - # - supervised: requires manual supervision to perform - # the switchover of the primary - primaryUpdateStrategy: unsupervised - # -- enable to create extra pgbouncer for readonly access - acceptRO: true - # -- storage size for the two pvc's per instance - storage: - size: "256Gi" - walsize: "256Gi" - pooler: - instances: 2 - # -- set to enable prometheus metrics - monitoring: - enablePodMonitor: false - # -- contains credentials and urls output by generator - creds: {} - mon: - enabled: true - # -- number of instances for both postgres and pgbouncer - instances: 2 - database: "app2" - user: "app2" - # password: - # superUserPassword: - # -- change to supervised to disable unsupervised updates - # Example of rolling update strategy: - # - unsupervised: automated update of the primary once all - # replicas have been upgraded (default) - # - supervised: requires manual supervision to perform - # the switchover of the primary - primaryUpdateStrategy: unsupervised - # -- enable to create extra pgbouncer for readonly access - acceptRO: true - # -- storage size for the two pvc's per instance - storage: - size: "256Gi" - walsize: "256Gi" - pooler: - instances: 2 - # -- set to enable prometheus metrics - monitoring: - enablePodMonitor: true - # -- contains credentials and urls output by generator - creds: {} diff --git a/library/common/templates/lib/dependencies/_dbWait.tpl b/library/common/templates/lib/dependencies/_dbWait.tpl index 435fab5d..7087717d 100644 --- a/library/common/templates/lib/dependencies/_dbWait.tpl +++ b/library/common/templates/lib/dependencies/_dbWait.tpl @@ -420,15 +420,18 @@ command: {{ $cnpgName := include "tc.v1.common.lib.chart.names.fullname" $ }} {{ $cnpgName = printf "%v-cnpg-%v" $cnpgName $name }} until + echo "Testing database on url: {{ $cnpgName }}" pg_isready -U {{ .user }} -h {{ $cnpgName }} do sleep 2 done until + echo "Testing database on url: {{ $cnpgName }}-rw" pg_isready -U {{ .user }} -h {{ $cnpgName }}-rw do sleep 2 done {{ if $cnpg.acceptRO }} until + echo "Testing database on url: {{ $cnpgName }}-ro" pg_isready -U {{ .user }} -h {{ $cnpgName }}-ro do sleep 2 done