Skip to content

Commit 470a1ea

Browse files
Add support for pg17 and remove pg12 (zalando#2773)
* Add support for pg17 * use new gcov2lcov-action * Use ghcr spilo-17 * Update SPILO_CURRENT and SPILO_LAZY * Update e2e/run.sh --------- Co-authored-by: Polina Bungina <[email protected]>
1 parent 34df486 commit 470a1ea

33 files changed

+106
-108
lines changed

.github/workflows/run_tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Run unit tests
2323
run: go test -race -covermode atomic -coverprofile=coverage.out ./...
2424
- name: Convert coverage to lcov
25-
uses: jandelgado/gcov2lcov-action@v1.0.9
25+
uses: jandelgado/gcov2lcov-action@v1.1.1
2626
- name: Coveralls
2727
uses: coverallsapp/github-action@master
2828
with:

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ pipelines with no access to Kubernetes API directly, promoting infrastructure as
2828

2929
### PostgreSQL features
3030

31-
* Supports PostgreSQL 16, starting from 12+
31+
* Supports PostgreSQL 17, starting from 13+
3232
* Streaming replication cluster via Patroni
3333
* Point-In-Time-Recovery with
34-
[pg_basebackup](https://www.postgresql.org/docs/16/app-pgbasebackup.html) /
34+
[pg_basebackup](https://www.postgresql.org/docs/17/app-pgbasebackup.html) /
3535
[WAL-E](https://github.com/wal-e/wal-e) via [Spilo](https://github.com/zalando/spilo)
3636
* Preload libraries: [bg_mon](https://github.com/CyberDem0n/bg_mon),
37-
[pg_stat_statements](https://www.postgresql.org/docs/16/pgstatstatements.html),
37+
[pg_stat_statements](https://www.postgresql.org/docs/17/pgstatstatements.html),
3838
[pgextwlist](https://github.com/dimitri/pgextwlist),
3939
[pg_auth_mon](https://github.com/RafiaSabih/pg_auth_mon)
4040
* Incl. popular Postgres extensions such as

charts/postgres-operator-ui/templates/deployment.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ spec:
8484
"limit_iops": 16000,
8585
"limit_throughput": 1000,
8686
"postgresql_versions": [
87+
"17",
8788
"16",
8889
"15",
8990
"14",
90-
"13",
91-
"12"
91+
"13"
9292
]
9393
}
9494
{{- if .Values.extraEnvs }}

charts/postgres-operator/crds/operatorconfigurations.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ spec:
6868
type: string
6969
docker_image:
7070
type: string
71-
default: "ghcr.io/zalando/spilo-16:3.3-p1"
71+
default: "ghcr.io/zalando/spilo-17:4.0-p2"
7272
enable_crd_registration:
7373
type: boolean
7474
default: true
@@ -167,10 +167,10 @@ spec:
167167
type: string
168168
minimal_major_version:
169169
type: string
170-
default: "12"
170+
default: "13"
171171
target_major_version:
172172
type: string
173-
default: "16"
173+
default: "17"
174174
kubernetes:
175175
type: object
176176
properties:

charts/postgres-operator/crds/postgresqls.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,11 @@ spec:
375375
version:
376376
type: string
377377
enum:
378-
- "12"
379378
- "13"
380379
- "14"
381380
- "15"
382381
- "16"
382+
- "17"
383383
parameters:
384384
type: object
385385
additionalProperties:

charts/postgres-operator/values.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ configGeneral:
3838
# etcd connection string for Patroni. Empty uses K8s-native DCS.
3939
etcd_host: ""
4040
# Spilo docker image
41-
docker_image: ghcr.io/zalando/spilo-16:3.3-p1
41+
docker_image: ghcr.io/zalando/spilo-17:4.0-p2
4242

4343
# key name for annotation to ignore globally configured instance limits
4444
# ignore_instance_limits_annotation_key: ""
@@ -89,9 +89,9 @@ configMajorVersionUpgrade:
8989
# - acid
9090

9191
# minimal Postgres major version that will not automatically be upgraded
92-
minimal_major_version: "12"
92+
minimal_major_version: "13"
9393
# target Postgres major version when upgrading clusters automatically
94-
target_major_version: "16"
94+
target_major_version: "17"
9595

9696
configKubernetes:
9797
# list of additional capabilities for postgres container

docs/administrator.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,7 @@ aws_or_gcp:
12971297

12981298
If cluster members have to be (re)initialized restoring physical backups
12991299
happens automatically either from the backup location or by running
1300-
[pg_basebackup](https://www.postgresql.org/docs/16/app-pgbasebackup.html)
1300+
[pg_basebackup](https://www.postgresql.org/docs/17/app-pgbasebackup.html)
13011301
on one of the other running instances (preferably replicas if they do not lag
13021302
behind). You can test restoring backups by [cloning](user.md#how-to-clone-an-existing-postgresql-cluster)
13031303
clusters.

docs/reference/cluster_manifest.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ the global configuration before adding the `tls` section'.
638638
## Change data capture streams
639639

640640
This sections enables change data capture (CDC) streams via Postgres'
641-
[logical decoding](https://www.postgresql.org/docs/16/logicaldecoding.html)
641+
[logical decoding](https://www.postgresql.org/docs/17/logicaldecoding.html)
642642
feature and `pgoutput` plugin. While the Postgres operator takes responsibility
643643
for providing the setup to publish change events, it relies on external tools
644644
to consume them. At Zalando, we are using a workflow based on
@@ -671,7 +671,7 @@ can have the following properties:
671671
The CDC operator is following the [outbox pattern](https://debezium.io/blog/2019/02/19/reliable-microservices-data-exchange-with-the-outbox-pattern/).
672672
The application is responsible for putting events into a (JSON/B or VARCHAR)
673673
payload column of the outbox table in the structure of the specified target
674-
event type. The operator will create a [PUBLICATION](https://www.postgresql.org/docs/16/logical-replication-publication.html)
674+
event type. The operator will create a [PUBLICATION](https://www.postgresql.org/docs/17/logical-replication-publication.html)
675675
in Postgres for all tables specified for one `database` and `applicationId`.
676676
The CDC operator will consume from it shortly after transactions are
677677
committed to the outbox table. The `idColumn` will be used in telemetry for

docs/reference/operator_parameters.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ Those are top-level keys, containing both leaf keys and groups.
9494
* **enable_pgversion_env_var**
9595
With newer versions of Spilo, it is preferable to use `PGVERSION` pod environment variable instead of the setting `postgresql.bin_dir` in the `SPILO_CONFIGURATION` env variable. When this option is true, the operator sets `PGVERSION` and omits `postgresql.bin_dir` from `SPILO_CONFIGURATION`. When false, the `postgresql.bin_dir` is set. This setting takes precedence over `PGVERSION`; see PR 222 in Spilo. The default is `true`.
9696

97-
* **enable_spilo_wal_path_compat**
98-
enables backwards compatible path between Spilo 12 and Spilo 13+ images. The default is `false`.
99-
10097
* **enable_team_id_clustername_prefix**
10198
To lower the risk of name clashes between clusters of different teams you
10299
can turn on this flag and the operator will sync only clusters where the
@@ -250,12 +247,12 @@ CRD-configuration, they are grouped under the `major_version_upgrade` key.
250247

251248
* **minimal_major_version**
252249
The minimal Postgres major version that will not automatically be upgraded
253-
when `major_version_upgrade_mode` is set to `"full"`. The default is `"12"`.
250+
when `major_version_upgrade_mode` is set to `"full"`. The default is `"13"`.
254251

255252
* **target_major_version**
256253
The target Postgres major version when upgrading clusters automatically
257254
which violate the configured allowed `minimal_major_version` when
258-
`major_version_upgrade_mode` is set to `"full"`. The default is `"16"`.
255+
`major_version_upgrade_mode` is set to `"full"`. The default is `"17"`.
259256

260257
## Kubernetes resources
261258

docs/user.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ spec:
3030
databases:
3131
foo: zalando
3232
postgresql:
33-
version: "16"
33+
version: "17"
3434
```
3535
3636
Once you cloned the Postgres Operator [repository](https://github.com/zalando/postgres-operator)
@@ -109,7 +109,7 @@ metadata:
109109
spec:
110110
[...]
111111
postgresql:
112-
version: "16"
112+
version: "17"
113113
parameters:
114114
password_encryption: scram-sha-256
115115
```
@@ -517,7 +517,7 @@ Postgres Operator will create the following NOLOGIN roles:
517517

518518
The `<dbname>_owner` role is the database owner and should be used when creating
519519
new database objects. All members of the `admin` role, e.g. teams API roles, can
520-
become the owner with the `SET ROLE` command. [Default privileges](https://www.postgresql.org/docs/16/sql-alterdefaultprivileges.html)
520+
become the owner with the `SET ROLE` command. [Default privileges](https://www.postgresql.org/docs/17/sql-alterdefaultprivileges.html)
521521
are configured for the owner role so that the `<dbname>_reader` role
522522
automatically gets read-access (SELECT) to new tables and sequences and the
523523
`<dbname>_writer` receives write-access (INSERT, UPDATE, DELETE on tables,
@@ -594,7 +594,7 @@ spec:
594594

595595
### Schema `search_path` for default roles
596596

597-
The schema [`search_path`](https://www.postgresql.org/docs/16/ddl-schemas.html#DDL-SCHEMAS-PATH)
597+
The schema [`search_path`](https://www.postgresql.org/docs/17/ddl-schemas.html#DDL-SCHEMAS-PATH)
598598
for each role will include the role name and the schemas, this role should have
599599
access to. So `foo_bar_writer` does not have to schema-qualify tables from
600600
schemas `foo_bar_writer, bar`, while `foo_writer` can look up `foo_writer` and
@@ -695,7 +695,7 @@ handle it.
695695

696696
### HugePages support
697697

698-
The operator supports [HugePages](https://www.postgresql.org/docs/16/kernel-resources.html#LINUX-HUGEPAGES).
698+
The operator supports [HugePages](https://www.postgresql.org/docs/17/kernel-resources.html#LINUX-HUGEPAGES).
699699
To enable HugePages, set the matching resource requests and/or limits in the manifest:
700700

701701
```yaml
@@ -838,7 +838,7 @@ spec:
838838
### Clone directly
839839

840840
Another way to get a fresh copy of your source DB cluster is via
841-
[pg_basebackup](https://www.postgresql.org/docs/16/app-pgbasebackup.html). To
841+
[pg_basebackup](https://www.postgresql.org/docs/17/app-pgbasebackup.html). To
842842
use this feature simply leave out the timestamp field from the clone section.
843843
The operator will connect to the service of the source cluster by name. If the
844844
cluster is called test, then the connection string will look like host=test

e2e/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ tools:
4646
# install pinned version of 'kind'
4747
# go install must run outside of a dir with a (module-based) Go project !
4848
# otherwise go install updates project's dependencies and/or behaves differently
49-
cd "/tmp" && GO111MODULE=on go install sigs.k8s.io/kind@v0.23.0
49+
cd "/tmp" && GO111MODULE=on go install sigs.k8s.io/kind@v0.24.0
5050

5151
e2etest: tools copy clean
5252
./run.sh main

e2e/run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ IFS=$'\n\t'
88

99
readonly cluster_name="postgres-operator-e2e-tests"
1010
readonly kubeconfig_path="/tmp/kind-config-${cluster_name}"
11-
readonly spilo_image="registry.opensource.zalan.do/acid/spilo-16-e2e:0.1"
11+
readonly spilo_image="registry.opensource.zalan.do/acid/spilo-17-e2e:0.3"
1212
readonly e2e_test_runner_image="registry.opensource.zalan.do/acid/postgres-operator-e2e-tests-runner:0.4"
1313

1414
export GOPATH=${GOPATH-~/go}

e2e/tests/test_e2e.py

+23-24
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212
from tests.k8s_api import K8s
1313
from kubernetes.client.rest import ApiException
1414

15-
SPILO_CURRENT = "registry.opensource.zalan.do/acid/spilo-16-e2e:0.1"
16-
SPILO_LAZY = "registry.opensource.zalan.do/acid/spilo-16-e2e:0.2"
17-
SPILO_FULL_IMAGE = "ghcr.io/zalando/spilo-16:3.2-p3"
18-
15+
SPILO_CURRENT = "registry.opensource.zalan.do/acid/spilo-17-e2e:0.3"
16+
SPILO_LAZY = "registry.opensource.zalan.do/acid/spilo-17-e2e:0.4"
17+
SPILO_FULL_IMAGE = "ghcr.io/zalando/spilo-17:4.0-p2"
1918

2019
def to_selector(labels):
2120
return ",".join(["=".join(lbl) for lbl in labels.items()])
@@ -1201,35 +1200,35 @@ def get_annotations():
12011200
k8s = self.k8s
12021201
cluster_label = 'application=spilo,cluster-name=acid-upgrade-test'
12031202

1204-
with open("manifests/minimal-postgres-manifest-12.yaml", 'r+') as f:
1203+
with open("manifests/minimal-postgres-lowest-version-manifest.yaml", 'r+') as f:
12051204
upgrade_manifest = yaml.safe_load(f)
12061205
upgrade_manifest["spec"]["dockerImage"] = SPILO_FULL_IMAGE
12071206

1208-
with open("manifests/minimal-postgres-manifest-12.yaml", 'w') as f:
1207+
with open("manifests/minimal-postgres-lowest-version-manifest.yaml", 'w') as f:
12091208
yaml.dump(upgrade_manifest, f, Dumper=yaml.Dumper)
12101209

1211-
k8s.create_with_kubectl("manifests/minimal-postgres-manifest-12.yaml")
1210+
k8s.create_with_kubectl("manifests/minimal-postgres-lowest-version-manifest.yaml")
12121211
self.eventuallyEqual(lambda: k8s.count_running_pods(labels=cluster_label), 2, "No 2 pods running")
12131212
self.eventuallyEqual(lambda: k8s.get_operator_state(), {"0": "idle"}, "Operator does not get in sync")
1214-
self.eventuallyEqual(check_version, 12, "Version is not correct")
1213+
self.eventuallyEqual(check_version, 13, "Version is not correct")
12151214

12161215
master_nodes, _ = k8s.get_cluster_nodes(cluster_labels=cluster_label)
12171216
# should upgrade immediately
1218-
pg_patch_version_13 = {
1217+
pg_patch_version_14 = {
12191218
"spec": {
12201219
"postgresql": {
1221-
"version": "13"
1220+
"version": "14"
12221221
}
12231222
}
12241223
}
12251224
k8s.api.custom_objects_api.patch_namespaced_custom_object(
1226-
"acid.zalan.do", "v1", "default", "postgresqls", "acid-upgrade-test", pg_patch_version_13)
1225+
"acid.zalan.do", "v1", "default", "postgresqls", "acid-upgrade-test", pg_patch_version_14)
12271226
self.eventuallyEqual(lambda: k8s.get_operator_state(), {"0": "idle"}, "Operator does not get in sync")
12281227

12291228
k8s.wait_for_pod_failover(master_nodes, 'spilo-role=replica,' + cluster_label)
12301229
k8s.wait_for_pod_start('spilo-role=master,' + cluster_label)
12311230
k8s.wait_for_pod_start('spilo-role=replica,' + cluster_label)
1232-
self.eventuallyEqual(check_version, 13, "Version should be upgraded from 12 to 13")
1231+
self.eventuallyEqual(check_version, 14, "Version should be upgraded from 13 to 14")
12331232

12341233
# check if annotation for last upgrade's success is set
12351234
annotations = get_annotations()
@@ -1238,34 +1237,34 @@ def get_annotations():
12381237
# should not upgrade because current time is not in maintenanceWindow
12391238
current_time = datetime.now()
12401239
maintenance_window_future = f"{(current_time+timedelta(minutes=60)).strftime('%H:%M')}-{(current_time+timedelta(minutes=120)).strftime('%H:%M')}"
1241-
pg_patch_version_14 = {
1240+
pg_patch_version_15 = {
12421241
"spec": {
12431242
"postgresql": {
1244-
"version": "14"
1243+
"version": "15"
12451244
},
12461245
"maintenanceWindows": [
12471246
maintenance_window_future
12481247
]
12491248
}
12501249
}
12511250
k8s.api.custom_objects_api.patch_namespaced_custom_object(
1252-
"acid.zalan.do", "v1", "default", "postgresqls", "acid-upgrade-test", pg_patch_version_14)
1251+
"acid.zalan.do", "v1", "default", "postgresqls", "acid-upgrade-test", pg_patch_version_15)
12531252
self.eventuallyEqual(lambda: k8s.get_operator_state(), {"0": "idle"}, "Operator does not get in sync")
12541253

12551254
k8s.wait_for_pod_failover(master_nodes, 'spilo-role=master,' + cluster_label)
12561255
k8s.wait_for_pod_start('spilo-role=master,' + cluster_label)
12571256
k8s.wait_for_pod_start('spilo-role=replica,' + cluster_label)
1258-
self.eventuallyEqual(check_version, 13, "Version should not be upgraded")
1257+
self.eventuallyEqual(check_version, 14, "Version should not be upgraded")
12591258

12601259
second_annotations = get_annotations()
12611260
self.assertIsNone(second_annotations.get("last-major-upgrade-failure"), "Annotation for last upgrade's failure should not be set")
12621261

12631262
# change the version again to trigger operator sync
12641263
maintenance_window_current = f"{(current_time-timedelta(minutes=30)).strftime('%H:%M')}-{(current_time+timedelta(minutes=30)).strftime('%H:%M')}"
1265-
pg_patch_version_15 = {
1264+
pg_patch_version_16 = {
12661265
"spec": {
12671266
"postgresql": {
1268-
"version": "15"
1267+
"version": "16"
12691268
},
12701269
"maintenanceWindows": [
12711270
maintenance_window_current
@@ -1274,40 +1273,40 @@ def get_annotations():
12741273
}
12751274

12761275
k8s.api.custom_objects_api.patch_namespaced_custom_object(
1277-
"acid.zalan.do", "v1", "default", "postgresqls", "acid-upgrade-test", pg_patch_version_15)
1276+
"acid.zalan.do", "v1", "default", "postgresqls", "acid-upgrade-test", pg_patch_version_16)
12781277
self.eventuallyEqual(lambda: k8s.get_operator_state(), {"0": "idle"}, "Operator does not get in sync")
12791278

12801279
k8s.wait_for_pod_failover(master_nodes, 'spilo-role=replica,' + cluster_label)
12811280
k8s.wait_for_pod_start('spilo-role=master,' + cluster_label)
12821281
k8s.wait_for_pod_start('spilo-role=replica,' + cluster_label)
1283-
self.eventuallyEqual(check_version, 15, "Version should be upgraded from 13 to 15")
1282+
self.eventuallyEqual(check_version, 16, "Version should be upgraded from 14 to 16")
12841283

12851284
# check if annotation for last upgrade's success is updated after second upgrade
12861285
third_annotations = get_annotations()
12871286
self.assertIsNotNone(third_annotations.get("last-major-upgrade-success"), "Annotation for last upgrade's success is not set")
12881287
self.assertNotEqual(annotations.get("last-major-upgrade-success"), third_annotations.get("last-major-upgrade-success"), "Annotation for last upgrade's success is not updated")
12891288

12901289
# test upgrade with failed upgrade annotation
1291-
pg_patch_version_16 = {
1290+
pg_patch_version_17 = {
12921291
"metadata": {
12931292
"annotations": {
12941293
"last-major-upgrade-failure": "2024-01-02T15:04:05Z"
12951294
},
12961295
},
12971296
"spec": {
12981297
"postgresql": {
1299-
"version": "16"
1298+
"version": "17"
13001299
},
13011300
},
13021301
}
13031302
k8s.api.custom_objects_api.patch_namespaced_custom_object(
1304-
"acid.zalan.do", "v1", "default", "postgresqls", "acid-upgrade-test", pg_patch_version_16)
1303+
"acid.zalan.do", "v1", "default", "postgresqls", "acid-upgrade-test", pg_patch_version_17)
13051304
self.eventuallyEqual(lambda: k8s.get_operator_state(), {"0": "idle"}, "Operator does not get in sync")
13061305

13071306
k8s.wait_for_pod_failover(master_nodes, 'spilo-role=master,' + cluster_label)
13081307
k8s.wait_for_pod_start('spilo-role=master,' + cluster_label)
13091308
k8s.wait_for_pod_start('spilo-role=replica,' + cluster_label)
1310-
self.eventuallyEqual(check_version, 15, "Version should not be upgraded because annotation for last upgrade's failure is set")
1309+
self.eventuallyEqual(check_version, 16, "Version should not be upgraded because annotation for last upgrade's failure is set")
13111310

13121311
# change the version back to 15 and should remove failure annotation
13131312
k8s.api.custom_objects_api.patch_namespaced_custom_object(

logical-backup/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ RUN apt-get update \
2525
&& curl --silent https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
2626
&& apt-get update \
2727
&& apt-get install --no-install-recommends -y \
28+
postgresql-client-17 \
2829
postgresql-client-16 \
2930
postgresql-client-15 \
3031
postgresql-client-14 \
3132
postgresql-client-13 \
32-
postgresql-client-12 \
3333
&& apt-get clean \
3434
&& rm -rf /var/lib/apt/lists/*
3535

manifests/complete-postgres-manifest.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ metadata:
1010
# "delete-date": "2020-08-31" # can only be deleted on that day if "delete-date "key is configured
1111
# "delete-clustername": "acid-test-cluster" # can only be deleted when name matches if "delete-clustername" key is configured
1212
spec:
13-
dockerImage: ghcr.io/zalando/spilo-16:3.3-p1
13+
dockerImage: ghcr.io/zalando/spilo-17:4.0-p2
1414
teamId: "acid"
1515
numberOfInstances: 2
1616
users: # Application/Robot users
@@ -48,7 +48,7 @@ spec:
4848
defaultRoles: true
4949
defaultUsers: false
5050
postgresql:
51-
version: "16"
51+
version: "17"
5252
parameters: # Expert section
5353
shared_buffers: "32MB"
5454
max_connections: "10"

0 commit comments

Comments
 (0)