Skip to content

Commit

Permalink
add the pg version 16 (#2557)
Browse files Browse the repository at this point in the history
* add the pg version 16

* add comma after pg16 in crds api

* change minimal_major_version to 12

* add new spilo image for pg16

* edit the registry from current and lazy spilo

* Update e2e/run.sh

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>

* Update README.md

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>

* add pg 11 to be compatible for the existing DBs

* update pq, pyyaml,k8s and kind version

* skip test_infrastructure_roles

* skip another test

* remove the skipping

* adjust the verification of new Patroni version states

---------

Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
  • Loading branch information
jopadi and FxKu committed Mar 13, 2024
1 parent 8bd9080 commit a5663da
Show file tree
Hide file tree
Showing 34 changed files with 79 additions and 88 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ pipelines with no access to Kubernetes API directly, promoting infrastructure as

### PostgreSQL features

* Supports PostgreSQL 15, starting from 10+
* Supports PostgreSQL 16, starting from 11+
* Streaming replication cluster via Patroni
* Point-In-Time-Recovery with
[pg_basebackup](https://www.postgresql.org/docs/11/app-pgbasebackup.html) /
[pg_basebackup](https://www.postgresql.org/docs/16/app-pgbasebackup.html) /
[WAL-E](https://github.com/wal-e/wal-e) via [Spilo](https://github.com/zalando/spilo)
* Preload libraries: [bg_mon](https://github.com/CyberDem0n/bg_mon),
[pg_stat_statements](https://www.postgresql.org/docs/15/pgstatstatements.html),
[pg_stat_statements](https://www.postgresql.org/docs/16/pgstatstatements.html),
[pgextwlist](https://github.com/dimitri/pgextwlist),
[pg_auth_mon](https://github.com/RafiaSabih/pg_auth_mon)
* Incl. popular Postgres extensions such as
Expand Down
3 changes: 1 addition & 2 deletions charts/postgres-operator-ui/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ spec:
"15",
"14",
"13",
"12",
"11"
"12"
]
}
{{- if .Values.extraEnvs }}
Expand Down
6 changes: 3 additions & 3 deletions charts/postgres-operator/crds/operatorconfigurations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ spec:
type: string
docker_image:
type: string
default: "ghcr.io/zalando/spilo-15:3.0-p1"
default: "ghcr.io/zalando/spilo-16:3.2-p2"
enable_crd_registration:
type: boolean
default: true
Expand Down Expand Up @@ -167,10 +167,10 @@ spec:
type: string
minimal_major_version:
type: string
default: "11"
default: "12"
target_major_version:
type: string
default: "15"
default: "16"
kubernetes:
type: object
properties:
Expand Down
2 changes: 1 addition & 1 deletion charts/postgres-operator/crds/postgresqls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,12 @@ spec:
version:
type: string
enum:
- "10"
- "11"
- "12"
- "13"
- "14"
- "15"
- "16"
parameters:
type: object
additionalProperties:
Expand Down
6 changes: 3 additions & 3 deletions charts/postgres-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ configGeneral:
# etcd connection string for Patroni. Empty uses K8s-native DCS.
etcd_host: ""
# Spilo docker image
docker_image: ghcr.io/zalando/spilo-15:3.0-p1
docker_image: ghcr.io/zalando/spilo-16:3.2-p2

# key name for annotation to ignore globally configured instance limits
# ignore_instance_limits_annotation_key: ""
Expand Down Expand Up @@ -89,9 +89,9 @@ configMajorVersionUpgrade:
# - acid

# minimal Postgres major version that will not automatically be upgraded
minimal_major_version: "11"
minimal_major_version: "12"
# target Postgres major version when upgrading clusters automatically
target_major_version: "15"
target_major_version: "16"

configKubernetes:
# list of additional capabilities for postgres container
Expand Down
1 change: 0 additions & 1 deletion docker/logical-backup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ RUN apt-get update \
postgresql-client-14 \
postgresql-client-13 \
postgresql-client-12 \
postgresql-client-11 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
2 changes: 1 addition & 1 deletion docs/administrator.md
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ aws_or_gcp:

If cluster members have to be (re)initialized restoring physical backups
happens automatically either from the backup location or by running
[pg_basebackup](https://www.postgresql.org/docs/15/app-pgbasebackup.html)
[pg_basebackup](https://www.postgresql.org/docs/16/app-pgbasebackup.html)
on one of the other running instances (preferably replicas if they do not lag
behind). You can test restoring backups by [cloning](user.md#how-to-clone-an-existing-postgresql-cluster)
clusters.
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/cluster_manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ the global configuration before adding the `tls` section'.
## Change data capture streams

This sections enables change data capture (CDC) streams via Postgres'
[logical decoding](https://www.postgresql.org/docs/15/logicaldecoding.html)
[logical decoding](https://www.postgresql.org/docs/16/logicaldecoding.html)
feature and `pgoutput` plugin. While the Postgres operator takes responsibility
for providing the setup to publish change events, it relies on external tools
to consume them. At Zalando, we are using a workflow based on
Expand Down Expand Up @@ -653,7 +653,7 @@ can have the following properties:
and `payloadColumn`). The CDC operator is following the [outbox pattern](https://debezium.io/blog/2019/02/19/reliable-microservices-data-exchange-with-the-outbox-pattern/).
The application is responsible for putting events into a (JSON/B or VARCHAR)
payload column of the outbox table in the structure of the specified target
event type. The operator will create a [PUBLICATION](https://www.postgresql.org/docs/15/logical-replication-publication.html)
event type. The operator will create a [PUBLICATION](https://www.postgresql.org/docs/16/logical-replication-publication.html)
in Postgres for all tables specified for one `database` and `applicationId`.
The CDC operator will consume from it shortly after transactions are
committed to the outbox table. The `idColumn` will be used in telemetry for
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/operator_parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,12 @@ CRD-configuration, they are grouped under the `major_version_upgrade` key.

* **minimal_major_version**
The minimal Postgres major version that will not automatically be upgraded
when `major_version_upgrade_mode` is set to `"full"`. The default is `"11"`.
when `major_version_upgrade_mode` is set to `"full"`. The default is `"12"`.

* **target_major_version**
The target Postgres major version when upgrading clusters automatically
which violate the configured allowed `minimal_major_version` when
`major_version_upgrade_mode` is set to `"full"`. The default is `"15"`.
`major_version_upgrade_mode` is set to `"full"`. The default is `"16"`.

## Kubernetes resources

Expand Down
14 changes: 7 additions & 7 deletions docs/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
databases:
foo: zalando
postgresql:
version: "15"
version: "16"
```

Once you cloned the Postgres Operator [repository](https://github.com/zalando/postgres-operator)
Expand Down Expand Up @@ -109,7 +109,7 @@ metadata:
spec:
[...]
postgresql:
version: "15"
version: "16"
parameters:
password_encryption: scram-sha-256
```
Expand Down Expand Up @@ -517,7 +517,7 @@ Postgres Operator will create the following NOLOGIN roles:

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

### Schema `search_path` for default roles

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

### HugePages support

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

```yaml
Expand Down Expand Up @@ -758,7 +758,7 @@ If you need to define a `nodeAffinity` for all your Postgres clusters use the
## In-place major version upgrade

Starting with Spilo 13, operator supports in-place major version upgrade to a
higher major version (e.g. from PG 10 to PG 13). To trigger the upgrade,
higher major version (e.g. from PG 11 to PG 13). To trigger the upgrade,
simply increase the version in the manifest. It is your responsibility to test
your applications against the new version before the upgrade; downgrading is
not supported. The easiest way to do so is to try the upgrade on the cloned
Expand Down Expand Up @@ -838,7 +838,7 @@ spec:
### Clone directly

Another way to get a fresh copy of your source DB cluster is via
[pg_basebackup](https://www.postgresql.org/docs/15/app-pgbasebackup.html). To
[pg_basebackup](https://www.postgresql.org/docs/16/app-pgbasebackup.html). To
use this feature simply leave out the timestamp field from the clone section.
The operator will connect to the service of the source cluster by name. If the
cluster is called test, then the connection string will look like host=test
Expand Down
2 changes: 1 addition & 1 deletion e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ tools:
# install pinned version of 'kind'
# go install must run outside of a dir with a (module-based) Go project !
# otherwise go install updates project's dependencies and/or behaves differently
cd "/tmp" && GO111MODULE=on go install sigs.k8s.io/kind@v0.14.0
cd "/tmp" && GO111MODULE=on go install sigs.k8s.io/kind@v0.22.0

e2etest: tools copy clean
./run.sh main
Expand Down
4 changes: 2 additions & 2 deletions e2e/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
kubernetes==24.2.0
kubernetes==29.2.0
timeout_decorator==0.5.0
pyyaml==6.0
pyyaml==6.0.1
2 changes: 1 addition & 1 deletion e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ IFS=$'\n\t'

readonly cluster_name="postgres-operator-e2e-tests"
readonly kubeconfig_path="/tmp/kind-config-${cluster_name}"
readonly spilo_image="registry.opensource.zalan.do/acid/spilo-15-e2e:0.1"
readonly spilo_image="registry.opensource.zalan.do/acid/spilo-16-e2e:0.1"
readonly e2e_test_runner_image="registry.opensource.zalan.do/acid/postgres-operator-e2e-tests-runner:0.4"

export GOPATH=${GOPATH-~/go}
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/k8s_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def get_operator_state(self):

def get_patroni_running_members(self, pod="acid-minimal-cluster-0"):
result = self.get_patroni_state(pod)
return list(filter(lambda x: "State" in x and x["State"] == "running", result))
return list(filter(lambda x: "State" in x and x["State"] in ["running", "streaming"], result))

def get_deployment_replica_count(self, name="acid-minimal-cluster-pooler", namespace="default"):
try:
Expand Down Expand Up @@ -583,7 +583,7 @@ def get_patroni_state(self, pod):

def get_patroni_running_members(self, pod):
result = self.get_patroni_state(pod)
return list(filter(lambda x: x["State"] == "running", result))
return list(filter(lambda x: x["State"] in ["running", "streaming"], result))

def get_statefulset_image(self, label_selector="application=spilo,cluster-name=acid-minimal-cluster", namespace='default'):
ssets = self.api.apps_v1.list_namespaced_stateful_set(namespace, label_selector=label_selector, limit=1)
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from tests.k8s_api import K8s
from kubernetes.client.rest import ApiException

SPILO_CURRENT = "registry.opensource.zalan.do/acid/spilo-15-e2e:0.1"
SPILO_LAZY = "registry.opensource.zalan.do/acid/spilo-15-e2e:0.2"
SPILO_CURRENT = "registry.opensource.zalan.do/acid/spilo-16-e2e:0.1"
SPILO_LAZY = "registry.opensource.zalan.do/acid/spilo-16-e2e:0.2"


def to_selector(labels):
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.19
require (
github.com/aws/aws-sdk-go v1.42.18
github.com/golang/mock v1.6.0
github.com/lib/pq v1.10.4
github.com/lib/pq v1.10.9
github.com/motomux/pretty v0.0.0-20161209205251-b2aad2c9a95d
github.com/pkg/errors v0.9.1
github.com/r3labs/diff v1.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk=
github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8=
Expand Down
4 changes: 2 additions & 2 deletions manifests/complete-postgres-manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
# "delete-date": "2020-08-31" # can only be deleted on that day if "delete-date "key is configured
# "delete-clustername": "acid-test-cluster" # can only be deleted when name matches if "delete-clustername" key is configured
spec:
dockerImage: ghcr.io/zalando/spilo-15:3.0-p1
dockerImage: ghcr.io/zalando/spilo-16:3.2-p2
teamId: "acid"
numberOfInstances: 2
users: # Application/Robot users
Expand Down Expand Up @@ -48,7 +48,7 @@ spec:
defaultRoles: true
defaultUsers: false
postgresql:
version: "15"
version: "16"
parameters: # Expert section
shared_buffers: "32MB"
max_connections: "10"
Expand Down
6 changes: 3 additions & 3 deletions manifests/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ data:
default_memory_request: 100Mi
# delete_annotation_date_key: delete-date
# delete_annotation_name_key: delete-clustername
docker_image: ghcr.io/zalando/spilo-15:3.0-p1
docker_image: ghcr.io/zalando/spilo-16:3.2-p2
# downscaler_annotations: "deployment-time,downscaler/*"
# enable_admin_role_for_users: "true"
# enable_crd_registration: "true"
Expand Down Expand Up @@ -107,7 +107,7 @@ data:
# max_memory_request: 4Gi
# min_cpu_limit: 250m
# min_memory_limit: 250Mi
# minimal_major_version: "11"
# minimal_major_version: "12"
# node_readiness_label: "status:ready"
# node_readiness_label_merge: "OR"
# oauth_token_secret_name: postgresql-operator
Expand Down Expand Up @@ -157,7 +157,7 @@ data:
spilo_privileged: "false"
storage_resize_mode: "pvc"
super_username: postgres
# target_major_version: "15"
# target_major_version: "16"
# team_admin_role: "admin"
# team_api_role_configuration: "log_statement:all"
# teams_api_url: http://fake-teams-api.default.svc.cluster.local
Expand Down
2 changes: 1 addition & 1 deletion manifests/minimal-postgres-manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ spec:
preparedDatabases:
bar: {}
postgresql:
version: "15"
version: "16"
6 changes: 3 additions & 3 deletions manifests/operatorconfiguration.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec:
type: string
docker_image:
type: string
default: "ghcr.io/zalando/spilo-15:3.0-p1"
default: "ghcr.io/zalando/spilo-16:3.2-p2"
enable_crd_registration:
type: boolean
default: true
Expand Down Expand Up @@ -165,10 +165,10 @@ spec:
type: string
minimal_major_version:
type: string
default: "11"
default: "12"
target_major_version:
type: string
default: "15"
default: "16"
kubernetes:
type: object
properties:
Expand Down
6 changes: 3 additions & 3 deletions manifests/postgresql-operator-default-configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: OperatorConfiguration
metadata:
name: postgresql-operator-default-configuration
configuration:
docker_image: ghcr.io/zalando/spilo-15:3.0-p1
docker_image: ghcr.io/zalando/spilo-16:3.2-p2
# enable_crd_registration: true
# crd_categories:
# - all
Expand Down Expand Up @@ -39,8 +39,8 @@ configuration:
major_version_upgrade_mode: "off"
# major_version_upgrade_team_allow_list:
# - acid
minimal_major_version: "11"
target_major_version: "15"
minimal_major_version: "12"
target_major_version: "16"
kubernetes:
# additional_pod_capabilities:
# - "SYS_NICE"
Expand Down
1 change: 0 additions & 1 deletion manifests/postgresql.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ spec:
version:
type: string
enum:
- "10"
- "11"
- "12"
- "13"
Expand Down
2 changes: 1 addition & 1 deletion manifests/standby-manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
size: 1Gi
numberOfInstances: 1
postgresql:
version: "15"
version: "16"
# Make this a standby cluster and provide either the s3 bucket path of source cluster or the remote primary host for continuous streaming.
standby:
# s3_wal_path: "s3://mybucket/spilo/acid-minimal-cluster/abcd1234-2a4b-4b2a-8c9c-c1234defg567/wal/14/"
Expand Down
3 changes: 0 additions & 3 deletions pkg/apis/acid.zalan.do/v1/crds.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,6 @@ var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{
"version": {
Type: "string",
Enum: []apiextv1.JSON{
{
Raw: []byte(`"10"`),
},
{
Raw: []byte(`"11"`),
},
Expand Down

0 comments on commit a5663da

Please sign in to comment.