Skip to content

Commit

Permalink
chore(cnpg-pooler): revert url changes temporary
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros-k authored Jan 21, 2024
1 parent 04e3a73 commit 988d82f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
30 changes: 15 additions & 15 deletions library/common-test/tests/cnpg/credentials_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ tests:
isSubset:
path: stringData
content:
porthost: test-release-name-common-test-cnpg-my-pg-pooler-rw:5432
host: test-release-name-common-test-cnpg-my-pg-pooler-rw
jdbc: jdbc:postgresql://test-release-name-common-test-cnpg-my-pg-pooler-rw:5432/test-db
porthost: test-release-name-common-test-cnpg-my-pg-rw:5432
host: test-release-name-common-test-cnpg-my-pg-rw
jdbc: jdbc:postgresql://test-release-name-common-test-cnpg-my-pg-rw:5432/test-db
- documentIndex: *secretDoc
matchRegex:
path: stringData.std
pattern: postgresql://test-user:[a-zA-Z0-9]{62}@test-release-name-common-test-cnpg-my-pg-pooler-rw:5432/test-db
pattern: postgresql://test-user:[a-zA-Z0-9]{62}@test-release-name-common-test-cnpg-my-pg-rw:5432/test-db
- documentIndex: *secretDoc
matchRegex:
path: stringData.nossl
pattern: postgresql://test-user:[a-zA-Z0-9]{62}@test-release-name-common-test-cnpg-my-pg-pooler-rw:5432/test-db\?sslmode=disable
pattern: postgresql://test-user:[a-zA-Z0-9]{62}@test-release-name-common-test-cnpg-my-pg-rw:5432/test-db\?sslmode=disable

- it: should generate correct secret with ro pooler
set:
Expand Down Expand Up @@ -92,28 +92,28 @@ tests:
isSubset:
path: stringData
content:
porthost: test-release-name-common-test-cnpg-my-pg-pooler-rw:5432
host: test-release-name-common-test-cnpg-my-pg-pooler-rw
jdbc: jdbc:postgresql://test-release-name-common-test-cnpg-my-pg-pooler-rw:5432/test-db
hostRO: test-release-name-common-test-cnpg-my-pg-pooler-ro
jdbcRO: jdbc:postgresql://test-release-name-common-test-cnpg-my-pg-pooler-ro:5432/test-db
porthostRO: test-release-name-common-test-cnpg-my-pg-pooler-ro:5432
porthost: test-release-name-common-test-cnpg-my-pg-rw:5432
host: test-release-name-common-test-cnpg-my-pg-rw
jdbc: jdbc:postgresql://test-release-name-common-test-cnpg-my-pg-rw:5432/test-db
hostRO: test-release-name-common-test-cnpg-my-pg-ro
jdbcRO: jdbc:postgresql://test-release-name-common-test-cnpg-my-pg-ro:5432/test-db
porthostRO: test-release-name-common-test-cnpg-my-pg-ro:5432
- documentIndex: *secretDoc
matchRegex:
path: stringData.std
pattern: postgresql://test-user:[a-zA-Z0-9]{62}@test-release-name-common-test-cnpg-my-pg-pooler-rw:5432/test-db
pattern: postgresql://test-user:[a-zA-Z0-9]{62}@test-release-name-common-test-cnpg-my-pg-rw:5432/test-db
- documentIndex: *secretDoc
matchRegex:
path: stringData.nossl
pattern: postgresql://test-user:[a-zA-Z0-9]{62}@test-release-name-common-test-cnpg-my-pg-pooler-rw:5432/test-db\?sslmode=disable
pattern: postgresql://test-user:[a-zA-Z0-9]{62}@test-release-name-common-test-cnpg-my-pg-rw:5432/test-db\?sslmode=disable
- documentIndex: *secretDoc
matchRegex:
path: stringData.stdRO
pattern: postgresql://test-user:[a-zA-Z0-9]{62}@test-release-name-common-test-cnpg-my-pg-pooler-ro:5432/test-db
pattern: postgresql://test-user:[a-zA-Z0-9]{62}@test-release-name-common-test-cnpg-my-pg-ro:5432/test-db
- documentIndex: *secretDoc
matchRegex:
path: stringData.nosslRO
pattern: postgresql://test-user:[a-zA-Z0-9]{62}@test-release-name-common-test-cnpg-my-pg-pooler-ro:5432/test-db\?sslmode=disable
pattern: postgresql://test-user:[a-zA-Z0-9]{62}@test-release-name-common-test-cnpg-my-pg-ro:5432/test-db\?sslmode=disable

- it: should generate correct secret with password set
set:
Expand Down
2 changes: 1 addition & 1 deletion library/common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ maintainers:
name: common
sources: null
type: library
version: 17.2.27
version: 17.2.28
20 changes: 10 additions & 10 deletions library/common/templates/lib/cnpg/_dbCredentialSecrets.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
{{- $jdbcTmpl := printf "jdbc:postgresql://%s-%%s:5432/%s" $objectData.name $objectData.database -}}

{{- $creds := (dict
"std" (printf $stdTmpl "pooler-rw")
"nossl" (printf $nosslTmpl "pooler-rw")
"portHost" (printf $portHostTmpl "pooler-rw")
"host" (printf $hostTmpl "pooler-rw")
"jdbc" (printf $jdbcTmpl "pooler-rw")
"std" (printf $stdTmpl "rw")
"nossl" (printf $nosslTmpl "rw")
"portHost" (printf $portHostTmpl "rw")
"host" (printf $hostTmpl "rw")
"jdbc" (printf $jdbcTmpl "rw")
) -}}

{{- $credsRO := dict -}}
{{- if $objectData.pooler.createRO -}}
{{- $credsRO = (dict
"std" (printf $stdTmpl "pooler-ro")
"nossl" (printf $nosslTmpl "pooler-ro")
"portHost" (printf $portHostTmpl "pooler-ro")
"host" (printf $hostTmpl "pooler-ro")
"jdbc" (printf $jdbcTmpl "pooler-ro")
"std" (printf $stdTmpl "ro")
"nossl" (printf $nosslTmpl "ro")
"portHost" (printf $portHostTmpl "ro")
"host" (printf $hostTmpl "ro")
"jdbc" (printf $jdbcTmpl "ro")
) -}}
{{- end -}}

Expand Down
8 changes: 4 additions & 4 deletions library/common/templates/lib/dependencies/_dbWait.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -368,15 +368,15 @@ command:
{{ $cnpgName = printf "%v-cnpg-%v" $cnpgName $name }}
echo "Detected RW pooler, testing RW pooler availability..."
until
echo "Testing database on url: {{ $cnpgName }}-pooler-rw"
pg_isready -U {{ .user }} -d {{ .database }} -h {{ $cnpgName }}-pooler-rw
echo "Testing database on url: {{ $cnpgName }}-rw"
pg_isready -U {{ .user }} -d {{ .database }} -h {{ $cnpgName }}-rw
do sleep 5
done
{{ if and $cnpg.pooler $cnpg.pooler.createRO }}
echo "Detected RO pooler, testing RO pooler availability..."
until
echo "Testing database on url: {{ $cnpgName }}-pooler-ro"
pg_isready -U {{ .user }} -d {{ .database }} -h {{ $cnpgName }}-pooler-ro
echo "Testing database on url: {{ $cnpgName }}-ro"
pg_isready -U {{ .user }} -d {{ .database }} -h {{ $cnpgName }}-ro
do sleep 5
done
{{ end }}
Expand Down

0 comments on commit 988d82f

Please sign in to comment.