mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
fix(postgres): move the default flavor to patched standard-trixie images
The default flavor pinned bare image tags, which are the system variant
on Debian bullseye. Upstream stopped building that variant, so the minors
that fix CVE-2026-116331 (18.7, 17.12, 16.16, 15.20, 14.25) are published
for bookworm and trixie only. The CVE is a type confusion in the min/max
aggregate optimisation that lets a role able to create objects run code
as the operating system user of the server, and tenants hold such roles.
Pin the patched minors on standard-trixie, and move the postgis flavor to
the same minors. The standard variant, because backups go through the
barman-cloud plugin and need none of the barman binaries the system
variant adds. trixie, because the postgis flavor is on it already, so
both image families share one Debian release. PostgreSQL 13 has no
patched release: it keeps 13.22 and moves to trixie with the rest.
For a running default-flavor cluster this changes the Debian release under
the data directory. The init Job rebuilds the indexes that depend on a
collation whose library version changed.
Assisted-by: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
(cherry picked from commit b40be51a6b)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
This commit is contained in:
1 parent
98866c9b49
commit
f0820507aa
6 files changed
+40
-33
No files matched your search
@@ -1,6 +1,6 @@
|
||||
"v18": "18.1-3.6.1-standard-trixie"
|
||||
"v17": "17.7-3.6.1-standard-trixie"
|
||||
"v16": "16.11-3.6.1-standard-trixie"
|
||||
"v15": "15.15-3.6.1-standard-trixie"
|
||||
"v14": "14.20-3.6.1-standard-trixie"
|
||||
"v18": "18.7-3.7.0-standard-trixie"
|
||||
"v17": "17.12-3.7.0-standard-trixie"
|
||||
"v16": "16.16-3.7.0-standard-trixie"
|
||||
"v15": "15.20-3.7.0-standard-trixie"
|
||||
"v14": "14.25-3.7.0-standard-trixie"
|
||||
"v13": "13.22-3.6.0-standard-trixie"
|
||||
@@ -1,6 +1,6 @@
|
||||
"v18": "v18.1"
|
||||
"v17": "v17.7"
|
||||
"v16": "v16.11"
|
||||
"v15": "v15.15"
|
||||
"v14": "v14.20"
|
||||
"v18": "v18.7"
|
||||
"v17": "v17.12"
|
||||
"v16": "v16.16"
|
||||
"v15": "v15.20"
|
||||
"v14": "v14.25"
|
||||
"v13": "v13.22"
|
||||
@@ -33,9 +33,10 @@ if ! command -v jq &> /dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get available image tags
|
||||
# Get available image tags. Only standard-trixie builds count: the chart
|
||||
# appends that suffix to the minor it reads from versions.yaml.
|
||||
echo "Fetching available image tags from registry..."
|
||||
AVAILABLE_TAGS=$(skopeo list-tags docker://ghcr.io/cloudnative-pg/postgresql | jq -r '.Tags[] | select(test("^[0-9]+\\.[0-9]+$"))' | sort -V)
|
||||
AVAILABLE_TAGS=$(skopeo list-tags docker://ghcr.io/cloudnative-pg/postgresql | jq -r '.Tags[] | select(test("^[0-9]+\\.[0-9]+-standard-trixie$")) | sub("-standard-trixie$"; "")' | sort -V)
|
||||
|
||||
if [ -z "$AVAILABLE_TAGS" ]; then
|
||||
echo "Error: Could not fetch available image tags" >&2
|
||||
|
||||
@@ -16,25 +16,33 @@
|
||||
|
||||
{{/*
|
||||
Single source for the operand image: the init Job runs psql against the
|
||||
Cluster, so both must resolve the same image.
|
||||
Cluster, so both must resolve the same image, and the Job compares its own
|
||||
PostgreSQL build with the server's to tell when a new image has rolled out.
|
||||
|
||||
standard-trixie, not the bare tag: a bare tag is the system variant on
|
||||
Debian bullseye, which upstream stopped building. The standard variant,
|
||||
because backups go through the barman-cloud plugin and need none of the
|
||||
barman binaries the system variant adds. trixie, because the postgis
|
||||
flavor is on it already, so both image families share one Debian release.
|
||||
*/}}
|
||||
{{- define "postgres.imageName" -}}
|
||||
{{- if eq (default "postgresql" .Values.flavor) "postgis" -}}
|
||||
ghcr.io/cloudnative-pg/postgis:{{ include "postgres.postgisVersionMap" . | trim }}
|
||||
{{- else -}}
|
||||
ghcr.io/cloudnative-pg/postgresql:{{ include "postgres.versionMap" . | trim | trimPrefix "v" }}
|
||||
ghcr.io/cloudnative-pg/postgresql:{{ include "postgres.versionMap" . | trim | trimPrefix "v" }}-standard-trixie
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
The flavor is fixed at bootstrap. The two image families are built on
|
||||
different Debian releases, so moving a live cluster from one to the other
|
||||
swaps glibc under an initialised data directory and silently invalidates
|
||||
every index on collatable text; the postgis-to-postgresql direction also
|
||||
drops the shared libraries behind every PostGIS object. CNPG would roll
|
||||
either change out as an ordinary image update, so refuse it here, before
|
||||
the Cluster is patched. Only the image name is compared: a minor bump or
|
||||
a registry mirror rewriting the host must keep passing.
|
||||
The flavor is fixed at bootstrap. Only the postgis image carries the shared
|
||||
libraries behind PostGIS objects, so the postgis-to-postgresql direction
|
||||
leaves every one of them without its code. The two families are also built
|
||||
and released separately, and nothing keeps their Debian release in step, so
|
||||
either direction can swap glibc and ICU under an initialised data directory
|
||||
together with the flavor. CNPG would roll either change out as an ordinary
|
||||
image update, so refuse it here, before the Cluster is patched. Only the
|
||||
image name is compared: a minor bump, a move to another variant of the same
|
||||
family, or a registry mirror rewriting the host must keep passing.
|
||||
|
||||
A physical recovery carries the same data directory across, so it is held
|
||||
to the same rule. With no live Cluster of its own yet, the release is
|
||||
@@ -49,14 +57,14 @@ ghcr.io/cloudnative-pg/postgresql:{{ include "postgres.versionMap" . | trim | tr
|
||||
{{- if and $live $live.spec $live.spec.imageName -}}
|
||||
{{- $liveName := regexReplaceAll "[:@].*$" (last (splitList "/" $live.spec.imageName)) "" -}}
|
||||
{{- if ne $liveName $wantName -}}
|
||||
{{- fail (printf "postgres: flavor cannot change on an existing cluster (running %s, requested %s). The image families use different glibc versions, which would corrupt text indexes. Create a new Postgres with the wanted flavor and move the data with a logical dump (pg_dump / pg_restore); restoring a backup keeps the flavor it was taken from." $liveName $wantName) -}}
|
||||
{{- fail (printf "postgres: flavor cannot change on an existing cluster (running %s, requested %s). Only the postgis image carries the PostGIS libraries, and the two image families can differ in glibc and ICU, which corrupts text indexes. Create a new Postgres with the wanted flavor and move the data with a logical dump (pg_dump / pg_restore); restoring a backup keeps the flavor it was taken from." $liveName $wantName) -}}
|
||||
{{- end -}}
|
||||
{{- else if and .Values.bootstrap.enabled .Values.bootstrap.oldName -}}
|
||||
{{- $source := lookup "postgresql.cnpg.io/v1" "Cluster" .Release.Namespace .Values.bootstrap.oldName -}}
|
||||
{{- if and $source $source.spec $source.spec.imageName -}}
|
||||
{{- $sourceName := regexReplaceAll "[:@].*$" (last (splitList "/" $source.spec.imageName)) "" -}}
|
||||
{{- if ne $sourceName $wantName -}}
|
||||
{{- fail (printf "postgres: cannot recover a %s backup of %s into the %s flavor. A physical restore keeps the source's glibc and libraries, which would corrupt text indexes. Set flavor to match the source, or create the new Postgres empty and move the data with a logical dump (pg_dump / pg_restore)." $sourceName .Values.bootstrap.oldName $wantName) -}}
|
||||
{{- fail (printf "postgres: cannot recover a %s backup of %s into the %s flavor. A physical restore carries over a data directory built with the source's libraries: PostGIS objects need the postgis image, and a glibc or ICU difference corrupts text indexes. Set flavor to match the source, or create the new Postgres empty and move the data with a logical dump (pg_dump / pg_restore)." $sourceName .Values.bootstrap.oldName $wantName) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -176,11 +176,9 @@ spec:
|
||||
The S3/barman settings live in the barmancloud.cnpg.io/ObjectStore CR
|
||||
rendered at the bottom of this file (named after the release); the
|
||||
Cluster only references it by name. Native spec.backup.barmanObjectStore
|
||||
is deprecated in CNPG 1.27 and removed in 1.29. The bare (system-flavor)
|
||||
image tags this chart pins still ship the barman-cloud-* binaries the
|
||||
native path needs (unlike the `standard` variant keycloak-db pins), but
|
||||
the system flavor is deprecated upstream, so this chart moves to the
|
||||
plugin as well.
|
||||
is deprecated in CNPG 1.27 and removed in 1.29, and the standard image
|
||||
variant this chart pins does not ship the barman-cloud-* binaries the
|
||||
native path needs; the plugin runs them in a sidecar.
|
||||
*/}}
|
||||
{{- $hasInlineCreds := and (ne (default "" .Values.backup.s3AccessKey) "") (ne (default "" .Values.backup.s3SecretKey) "") }}
|
||||
{{- $hasLegacyCreds := or $hasInlineCreds (ne (default "" $credCfg.name) "") }}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
suite: postgres image flavor
|
||||
# The Cluster and the init Job must resolve the same image, and a live
|
||||
# cluster must never be moved to the other flavor: the two image families
|
||||
# ship different glibc versions, so CNPG would roll an image swap that
|
||||
# corrupts collatable indexes. Tags are matched by pattern so that
|
||||
# cluster must never be moved to the other flavor: only one image family
|
||||
# carries the PostGIS libraries, and CNPG would roll the swap out as an
|
||||
# ordinary image update. Tags are matched by pattern so that
|
||||
# hack/update-versions.sh can bump minors without touching this suite.
|
||||
release:
|
||||
name: pg-test
|
||||
@@ -20,7 +20,7 @@ tests:
|
||||
asserts:
|
||||
- matchRegex:
|
||||
path: spec.imageName
|
||||
pattern: ^ghcr\.io/cloudnative-pg/postgresql:18\.[0-9]+$
|
||||
pattern: ^ghcr\.io/cloudnative-pg/postgresql:18\.[0-9]+-standard-trixie$
|
||||
|
||||
- it: postgis flavor switches the Cluster to the standard-trixie PostGIS image
|
||||
set:
|
||||
|
||||
Reference in new issue
Block a user