Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/common-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ jobs:
- metrics-values.yaml
- cnpg-values.yaml
- cnpg-multi-values.yaml
- cnpg-pg17-values.yaml
- cnpg-pg18-values.yaml
- cnpg-pg18-postgis-values.yaml
- register-operator-values.yaml
## TODO: reenable when we've some credentials ready to rock for testing
# - volsync-dest-values.yaml
Expand Down
51 changes: 51 additions & 0 deletions charts/library/common-test/ci/cnpg-pg17-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
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

cnpg:
main:
enabled: true
# -- exercise PostgreSQL 17 (postgres17Image)
pgVersion: 17
# -- number of instances for both postgres and pgbouncer
instances: 2
database: "app"
user: "app"
password: test-password
# -- change to supervised to disable unsupervised updates
primaryUpdateStrategy: unsupervised
# -- storage size for the two pvc's per instance
storage:
size: "256Gi"
walsize: "256Gi"
pooler:
# -- enable to create extra pgbouncer for readonly access
createRO: false
instances: 2
# -- set to enable prometheus metrics
monitoring:
enablePodMonitor: false
# -- contains credentials and urls output by generator
creds: {}
52 changes: 52 additions & 0 deletions charts/library/common-test/ci/cnpg-pg18-postgis-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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

cnpg:
main:
enabled: true
# -- exercise PostGIS on PostgreSQL 18 (postgresPostgis18Image)
type: postgis
pgVersion: 18
# -- number of instances for both postgres and pgbouncer
instances: 2
database: "app"
user: "app"
password: test-password
# -- change to supervised to disable unsupervised updates
primaryUpdateStrategy: unsupervised
# -- storage size for the two pvc's per instance
storage:
size: "256Gi"
walsize: "256Gi"
pooler:
# -- enable to create extra pgbouncer for readonly access
createRO: false
instances: 2
# -- set to enable prometheus metrics
monitoring:
enablePodMonitor: false
# -- contains credentials and urls output by generator
creds: {}
51 changes: 51 additions & 0 deletions charts/library/common-test/ci/cnpg-pg18-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
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

cnpg:
main:
enabled: true
# -- exercise PostgreSQL 18 (postgres18Image)
pgVersion: 18
# -- number of instances for both postgres and pgbouncer
instances: 2
database: "app"
user: "app"
password: test-password
# -- change to supervised to disable unsupervised updates
primaryUpdateStrategy: unsupervised
# -- storage size for the two pvc's per instance
storage:
size: "256Gi"
walsize: "256Gi"
pooler:
# -- enable to create extra pgbouncer for readonly access
createRO: false
instances: 2
# -- set to enable prometheus metrics
monitoring:
enablePodMonitor: false
# -- contains credentials and urls output by generator
creds: {}
131 changes: 131 additions & 0 deletions charts/library/common-test/tests/cnpg/cluster_spec_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,137 @@ tests:
path: spec.imageName
value: ghcr.io/cloudnative-pg/postgresql:15.6

- it: should generate correct imageName for postgres pgVersion 17
set:
postgres17Image:
repository: ghcr.io/cloudnative-pg/postgresql
tag: "17.10"
cnpg:
my-pg:
enabled: true
user: test-user
database: test-db
password: test-password
pgVersion: 17
asserts:
- documentIndex: *clusterDoc
equal:
path: spec.imageName
value: ghcr.io/cloudnative-pg/postgresql:17.10

- it: should generate correct imageName for postgres pgVersion 18
set:
postgres18Image:
repository: ghcr.io/cloudnative-pg/postgresql
tag: "18.4"
cnpg:
my-pg:
enabled: true
user: test-user
database: test-db
password: test-password
pgVersion: 18
asserts:
- documentIndex: *clusterDoc
equal:
path: spec.imageName
value: ghcr.io/cloudnative-pg/postgresql:18.4

- it: should generate correct imageName for postgis pgVersion 17
set:
postgresPostgis17Image:
repository: ghcr.io/cloudnative-pg/postgis
tag: "17-3.5"
cnpg:
my-pg:
enabled: true
user: test-user
database: test-db
password: test-password
type: postgis
pgVersion: 17
asserts:
- documentIndex: *clusterDoc
equal:
path: spec.imageName
value: ghcr.io/cloudnative-pg/postgis:17-3.5

- it: should generate correct imageName for postgis pgVersion 18
set:
postgresPostgis18Image:
repository: ghcr.io/cloudnative-pg/postgis
tag: "18-3.6-standard-bookworm"
cnpg:
my-pg:
enabled: true
user: test-user
database: test-db
password: test-password
type: postgis
pgVersion: 18
asserts:
- documentIndex: *clusterDoc
equal:
path: spec.imageName
value: ghcr.io/cloudnative-pg/postgis:18-3.6-standard-bookworm

- it: should generate correct imageName for vectors pgVersion 17
set:
postgresVectors17Image:
repository: ghcr.io/tensorchord/cloudnative-pgvecto.rs
tag: "17.5-v0.4.0"
cnpg:
my-pg:
enabled: true
user: test-user
database: test-db
password: test-password
type: vectors
pgVersion: 17
asserts:
- documentIndex: *clusterDoc
equal:
path: spec.imageName
value: ghcr.io/tensorchord/cloudnative-pgvecto.rs:17.5-v0.4.0

- it: should generate correct imageName for vectorchord pgVersion 17
set:
postgresVectorchord17Image:
repository: ghcr.io/tensorchord/cloudnative-vectorchord
tag: "17.9-1.1.1"
cnpg:
my-pg:
enabled: true
user: test-user
database: test-db
password: test-password
type: vectorchord
pgVersion: 17
asserts:
- documentIndex: *clusterDoc
equal:
path: spec.imageName
value: ghcr.io/tensorchord/cloudnative-vectorchord:17.9-1.1.1

- it: should generate correct imageName for vectorchord pgVersion 18
set:
postgresVectorchord18Image:
repository: ghcr.io/tensorchord/cloudnative-vectorchord
tag: "18.3-1.1.1"
cnpg:
my-pg:
enabled: true
user: test-user
database: test-db
password: test-password
type: vectorchord
pgVersion: 18
asserts:
- documentIndex: *clusterDoc
equal:
path: spec.imageName
value: ghcr.io/tensorchord/cloudnative-vectorchord:18.3-1.1.1

- it: should override options
set:
ext1: some-extension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,21 @@ tests:
pgVersion: invalid
asserts:
- failedTemplate:
errorMessage: CNPG - Expected [pgVersion] to be one of [15, 16], but got [invalid]
errorMessage: CNPG - Expected [pgVersion] to be one of [15, 16, 17, 18], but got [invalid]

- it: should fail with vectors on pgVersion 18
set:
cnpg:
my-pg:
enabled: true
user: test-user
database: test-db
password: test-password
type: vectors
pgVersion: 18
asserts:
- failedTemplate:
errorMessage: CNPG Cluster - type [vectors] is not available for pgVersion [18]; pgvecto.rs has been superseded by VectorChord, use type [vectorchord] instead

- it: should fail with hibernate not a bool
set:
Expand Down
2 changes: 1 addition & 1 deletion charts/library/common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ sources:
- https://github.com/trueforge-org/truecharts/tree/master/charts/library/common
- https://hub.docker.com/_/
type: library
version: 30.0.0
version: 30.1.0
2 changes: 1 addition & 1 deletion charts/library/common/docs/cnpg/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ Define a CNPG cluster
| Required | ❌ |
| Helm `tpl` | ❌ |
| Default | `16` |
| Enum | `15`, `16` |
| Enum | `15`, `16`, `17`, `18` |

Example

Expand Down
4 changes: 3 additions & 1 deletion charts/library/common/schemas/cnpg/cnpg.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@
"type": "integer",
"enum": [
15,
16
16,
17,
18
],
"description": "Define a CNPG cluster",
"default": 16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{{- fail (printf "CNPG - Expected [pgVersion] to be a string, but got [%s]" (kindOf $objectData.pgVersion)) -}}
{{- end -}}

{{- $validVersions := (list "15" "16") -}}
{{- $validVersions := (list "15" "16" "17" "18") -}}
{{- if not (mustHas $objectData.pgVersion $validVersions) -}}
{{- fail (printf "CNPG - Expected [pgVersion] to be one of [%s], but got [%s]" (join ", " $validVersions) $objectData.pgVersion) -}}
{{- end -}}
Expand Down Expand Up @@ -45,6 +45,11 @@
{{- end -}}
{{- end -}}

{{/* pgvecto.rs (type vectors) publishes no PostgreSQL 18 image; it is superseded by VectorChord */}}
{{- if and (eq ($objectData.type | default "postgres") "vectors") (eq ($objectData.pgVersion | toString) "18") -}}
{{- fail "CNPG Cluster - type [vectors] is not available for pgVersion [18]; pgvecto.rs has been superseded by VectorChord, use type [vectorchord] instead" -}}
{{- end -}}

{{- if (hasKey $objectData "cluster") -}}
{{- if (hasKey $objectData.cluster "logLevel") -}}
{{- $validLevels := (list "error" "warning" "info" "debug" "trace") -}}
Expand Down
Loading
Loading