From 6014860c9330bc577252067ba7509d7745d0d8d4 Mon Sep 17 00:00:00 2001 From: Nimesh Kulkarni <167794819+GitNimay@users.noreply.github.com> Date: Mon, 23 Nov 2026 09:28:22 +0530 Subject: [PATCH 1/3] fix(tenant): default only the resources the tenant quota bounds The tenant chart rendered tenant-range-limits whenever resourceQuotas was non-empty. Its 128Mi default memory limit then applied under a quota on load balancers, storage or GPUs alone, or on cpu or ephemeral-storage without memory, and refused any pod that requests more memory without a limit of its own, virt-launcher included, so VMs could not start in such a tenant. The LimitRange is there so pods without requests or limits pass a quota that tracks cpu, memory or ephemeral-storage. Default each of those three only when the flattened quota bounds that resource, and render no LimitRange when it bounds none of them. A quota on all three renders the LimitRange exactly as before, with the same values. Closes: #4930 Assisted-by: LLM Signed-off-by: Nimesh Kulkarni <167794819+GitNimay@users.noreply.github.com> --- packages/apps/tenant/templates/quota.yaml | 24 +++ .../tenant/tests/quota_limitrange_test.yaml | 186 ++++++++++++++++++ 2 files changed, 210 insertions(+) create mode 100644 packages/apps/tenant/tests/quota_limitrange_test.yaml diff --git a/packages/apps/tenant/templates/quota.yaml b/packages/apps/tenant/templates/quota.yaml index 6962d7c3a..b32917321 100644 --- a/packages/apps/tenant/templates/quota.yaml +++ b/packages/apps/tenant/templates/quota.yaml @@ -7,6 +7,17 @@ metadata: spec: hard: {{- include "cozy-lib.resources.flatten" (list .Values.resourceQuotas $) | nindent 6 }} +{{- /* The LimitRange only exists so pods without requests or limits still pass + a quota that tracks them, so it defaults only the resources the quota + bounds. A default limit on any other resource does nothing for the quota + and refuses every container that requests more without a limit of its + own: a 128Mi memory default under a quota on load balancers, cpu or + ephemeral-storage alone kept virt-launcher from starting. */}} +{{- $hard := include "cozy-lib.resources.flatten" (list .Values.resourceQuotas $) | fromYaml }} +{{- $cpu := or (hasKey $hard "requests.cpu") (hasKey $hard "limits.cpu") }} +{{- $memory := or (hasKey $hard "requests.memory") (hasKey $hard "limits.memory") }} +{{- $ephemeral := or (hasKey $hard "requests.ephemeral-storage") (hasKey $hard "limits.ephemeral-storage") }} +{{- if or $cpu $memory $ephemeral }} --- apiVersion: v1 kind: LimitRange @@ -16,12 +27,25 @@ metadata: spec: limits: - default: + {{- if $cpu }} cpu: "250m" + {{- end }} + {{- if $memory }} memory: "128Mi" + {{- end }} + {{- if $ephemeral }} ephemeral-storage: "2Gi" + {{- end }} defaultRequest: + {{- if $cpu }} cpu: "25m" + {{- end }} + {{- if $memory }} memory: "128Mi" + {{- end }} + {{- if $ephemeral }} ephemeral-storage: "50Mi" + {{- end }} type: Container {{- end }} +{{- end }} diff --git a/packages/apps/tenant/tests/quota_limitrange_test.yaml b/packages/apps/tenant/tests/quota_limitrange_test.yaml new file mode 100644 index 000000000..1de01e576 --- /dev/null +++ b/packages/apps/tenant/tests/quota_limitrange_test.yaml @@ -0,0 +1,186 @@ +suite: tenant LimitRange defaults only what the quota bounds + +# The LimitRange defaults requests and limits so pods without them still pass a +# quota that tracks cpu, memory or ephemeral-storage. A default on a resource +# the quota does not bound only gets in the way: its 128Mi memory limit refuses +# any container that requests more without a limit of its own, virt-launcher +# included. Each test pins the document count, so a quota that stops rendering +# at all reddens here too. +templates: + - templates/quota.yaml + +release: + name: tenant-test + namespace: tenant-test + +tests: + - it: renders nothing without resourceQuotas + asserts: + - hasDocuments: + count: 0 + + - it: renders no LimitRange under a quota on load balancers alone + set: + resourceQuotas: + services.loadbalancers: "1" + asserts: + - hasDocuments: + count: 1 + - isKind: + of: ResourceQuota + documentSelector: + path: kind + value: ResourceQuota + - equal: + path: spec.hard["services.loadbalancers"] + value: "1" + documentSelector: + path: kind + value: ResourceQuota + + - it: renders no LimitRange under a quota on storage alone + set: + resourceQuotas: + storage: 100Gi + asserts: + - hasDocuments: + count: 1 + - isKind: + of: ResourceQuota + documentSelector: + path: kind + value: ResourceQuota + + - it: renders no LimitRange under a quota on GPUs alone + set: + resourceQuotas: + nvidia.com/gpu: "2" + asserts: + - hasDocuments: + count: 1 + - isKind: + of: ResourceQuota + documentSelector: + path: kind + value: ResourceQuota + + - it: keeps every default under a quota on cpu, memory and ephemeral-storage + set: + resourceQuotas: + cpu: "4" + memory: 8Gi + ephemeral-storage: 10Gi + asserts: + - hasDocuments: + count: 2 + - isKind: + of: LimitRange + documentSelector: + path: kind + value: LimitRange + - equal: + path: metadata.name + value: tenant-range-limits + documentSelector: + path: kind + value: LimitRange + - equal: + path: spec.limits[0].default + value: + cpu: 250m + memory: 128Mi + ephemeral-storage: 2Gi + documentSelector: + path: kind + value: LimitRange + - equal: + path: spec.limits[0].defaultRequest + value: + cpu: 25m + memory: 128Mi + ephemeral-storage: 50Mi + documentSelector: + path: kind + value: LimitRange + + - it: defaults only cpu under a quota on cpu alone + set: + resourceQuotas: + cpu: "4" + asserts: + - hasDocuments: + count: 2 + - equal: + path: spec.limits[0].default + value: + cpu: 250m + documentSelector: + path: kind + value: LimitRange + - equal: + path: spec.limits[0].defaultRequest + value: + cpu: 25m + documentSelector: + path: kind + value: LimitRange + + - it: defaults only memory under a quota on memory alone + set: + resourceQuotas: + memory: 8Gi + asserts: + - hasDocuments: + count: 2 + - equal: + path: spec.limits[0].default + value: + memory: 128Mi + documentSelector: + path: kind + value: LimitRange + - equal: + path: spec.limits[0].defaultRequest + value: + memory: 128Mi + documentSelector: + path: kind + value: LimitRange + + - it: defaults only ephemeral-storage under a quota on ephemeral-storage alone + set: + resourceQuotas: + ephemeral-storage: 10Gi + asserts: + - hasDocuments: + count: 2 + - equal: + path: spec.limits[0].default + value: + ephemeral-storage: 2Gi + documentSelector: + path: kind + value: LimitRange + - equal: + path: spec.limits[0].defaultRequest + value: + ephemeral-storage: 50Mi + documentSelector: + path: kind + value: LimitRange + + - it: defaults only memory when memory sits beside non-compute quota keys + set: + resourceQuotas: + services.loadbalancers: "1" + memory: 8Gi + asserts: + - hasDocuments: + count: 2 + - equal: + path: spec.limits[0].default + value: + memory: 128Mi + documentSelector: + path: kind + value: LimitRange From 46f03b87488831b4f066e1ddf89f5cce055b9b87 Mon Sep 17 00:00:00 2001 From: Nimesh Kulkarni <167794819+GitNimay@users.noreply.github.com> Date: Thu, 19 Nov 2026 11:48:45 +0530 Subject: [PATCH 2/3] docs(tenant): qualify LimitRange defaults by the bounded resource tenant-range-limits now defaults cpu, memory and ephemeral-storage each only when resourceQuotas bounds that resource, and is not rendered at all under a quota on none of them. Comments in the operator, the tenant quota controller, the backup controller and the barman and kafka charts still said every tenant with resourceQuotas gets a 128Mi memory default, which would mislead the next change made on that assumption. The tenant quota controller's gate on limits.cpu or limits.memory stays: a root rendered by an older chart may still carry a LimitRange under a quota that bounds no compute. Assisted-by: LLM Signed-off-by: Nimesh Kulkarni <167794819+GitNimay@users.noreply.github.com> --- .../cnpgstrategy_controller.go | 17 +++++++++-------- internal/controller/tenantquota/reconciler.go | 9 +++++---- .../controller/tenantquota/reconciler_test.go | 5 +++-- internal/operator/package_reconciler.go | 3 ++- internal/operator/package_reconciler_test.go | 2 +- packages/apps/kafka/templates/kafka.yaml | 3 ++- .../library/cozy-lib/templates/_barman.tpl | 19 ++++++++++--------- 7 files changed, 32 insertions(+), 26 deletions(-) diff --git a/internal/backupcontroller/cnpgstrategy_controller.go b/internal/backupcontroller/cnpgstrategy_controller.go index caf2fac39..4773f1cdf 100644 --- a/internal/backupcontroller/cnpgstrategy_controller.go +++ b/internal/backupcontroller/cnpgstrategy_controller.go @@ -2932,15 +2932,16 @@ func buildBarmanPlugin(objectStoreName, serverName string) cnpgtypes.PluginConfi // cannot get right on its own. // // Resources: the plugin injects the sidecar with no resources. This ObjectStore -// lands in the application's namespace, and a tenant with resourceQuotas set -// carries a LimitRange (packages/apps/tenant/templates/quota.yaml) that defaults -// every container to 128Mi; the sidecar is OOMKilled mid-backup under it, -// leaving the ObjectStore healthy and the backup failed. Measured cgroup +// lands in the application's namespace, and a tenant whose resourceQuotas bound +// memory carries a LimitRange (packages/apps/tenant/templates/quota.yaml) that +// defaults every container to 128Mi; the sidecar is OOMKilled mid-backup under +// it, leaving the ObjectStore healthy and the backup failed. Measured cgroup // high-water mark on a 38 MB database is 254 MiB, so 128Mi cannot hold it. A -// tenant that leaves resourceQuotas empty has no LimitRange, and there the -// sidecar had no requests and no limit at all. 256Mi holds the measured working -// set and 1Gi is four times the measurement. The CPU limit is explicit for the -// same reason: left unset, that LimitRange gives the sidecar its 250m default, +// tenant whose resourceQuotas bound none of cpu, memory or ephemeral-storage has +// no LimitRange, and there the sidecar had no requests and no limit at all. +// 256Mi holds the measured working set and 1Gi is four times the measurement. +// The CPU limit is explicit for the same reason: left unset, a LimitRange under +// a cpu quota gives the sidecar its 250m default, // so gzip compression of full backups and WAL segments runs on a quarter of a // core (a 1.6 GB database took 30 minutes to back up). One core keeps the // sidecar from starving the instance while removing that ceiling; it counts diff --git a/internal/controller/tenantquota/reconciler.go b/internal/controller/tenantquota/reconciler.go index ed18499ce..56ecea425 100644 --- a/internal/controller/tenantquota/reconciler.go +++ b/internal/controller/tenantquota/reconciler.go @@ -354,10 +354,11 @@ func ownedNamespace(hrNamespace, appName string) string { // boundsComputeLimits reports whether a quota bounds limits.cpu or // limits.memory, the only case in which admission rejects a container that -// omits a limit. The chart renders its LimitRange under any non-empty -// resourceQuotas, so the root may carry one under a quota that bounds no -// compute at all; copying it then would impose default limits the quota -// never asked for. +// omits a limit. The chart's LimitRange defaults only the resources the root's +// quota bounds, but a root created by an older chart may still carry one +// rendered under any non-empty resourceQuotas, compute or not; copying it to a +// member whose quota bounds no compute limit would impose default limits the +// quota never asked for. func boundsComputeLimits(hard corev1.ResourceList) bool { _, cpu := hard[corev1.ResourceLimitsCPU] _, memory := hard[corev1.ResourceLimitsMemory] diff --git a/internal/controller/tenantquota/reconciler_test.go b/internal/controller/tenantquota/reconciler_test.go index b869825dc..f89d4bd7e 100644 --- a/internal/controller/tenantquota/reconciler_test.go +++ b/internal/controller/tenantquota/reconciler_test.go @@ -364,8 +364,9 @@ func TestReconcile_PoolRootWithoutLimitRange(t *testing.T) { } } -// TestReconcile_NoLimitRangeWithoutComputeLimitQuota: the chart renders its -// LimitRange for any non-empty resourceQuotas, compute or not. A member whose +// TestReconcile_NoLimitRangeWithoutComputeLimitQuota: a chart release older +// than the per-resource defaults renders its LimitRange for any non-empty +// resourceQuotas, compute or not, and the root may still carry it. A member whose // allocated quota bounds neither limits.cpu nor limits.memory is admitted // without limits today; copying the root's defaults there would cap or refuse // pods (one requesting more than the default memory limit, for instance) diff --git a/internal/operator/package_reconciler.go b/internal/operator/package_reconciler.go index c03da6edb..51d585cd3 100644 --- a/internal/operator/package_reconciler.go +++ b/internal/operator/package_reconciler.go @@ -950,7 +950,8 @@ func (r *PackageReconciler) deleteManagedSystemDefaultsLimitRanges(ctx context.C // Defaulting a limit across system namespaces takes those components out of the candidate // set. Tenant namespaces are skipped because the tenant chart owns LimitRange policy // there: packages/apps/tenant ships tenant-range-limits, which defaults container memory -// to 128Mi in every tenant namespace that declares resourceQuotas. Handing a second, +// to 128Mi in every tenant namespace whose resourceQuotas bound memory (and cpu or +// ephemeral-storage likewise, each only when the quota bounds it). Handing a second, // system-owned LimitRange to those namespaces would layer a competing default on top of // the chart's own, so the operator stays out. // diff --git a/internal/operator/package_reconciler_test.go b/internal/operator/package_reconciler_test.go index fd8a15fe5..0836c279e 100644 --- a/internal/operator/package_reconciler_test.go +++ b/internal/operator/package_reconciler_test.go @@ -914,7 +914,7 @@ func TestReconcileSystemDefaultsLimitRangeForcesOnlyAnOwnedObject(t *testing.T) // The tenant boundary. It is one strings.HasPrefix, and everything downstream of it depends // on it holding: packages/apps/tenant ships tenant-range-limits, which defaults container -// memory to 128Mi in every tenant namespace with resourceQuotas. A system LimitRange landing +// memory to 128Mi in every tenant namespace whose resourceQuotas bound memory. A system LimitRange landing // beside it would leave two LimitRanges defaulting the same containers, and which one wins // is decided by the order LimitRanger happens to iterate them — neither chart controls that, // so a tenant container's default memory limit would move between 128Mi and 4Gi with nothing diff --git a/packages/apps/kafka/templates/kafka.yaml b/packages/apps/kafka/templates/kafka.yaml index b7039ace1..a0779681b 100644 --- a/packages/apps/kafka/templates/kafka.yaml +++ b/packages/apps/kafka/templates/kafka.yaml @@ -76,7 +76,8 @@ spec: name: {{ .Release.Name }}-metrics key: kafka-metrics-config.yml entityOperator: - # Tenant namespaces ship a LimitRange that defaults containers to 128Mi. + # Tenant namespaces whose quota bounds memory ship a LimitRange that + # defaults containers to 128Mi. # The topic-operator and user-operator are JVM processes and OOMKill at # that default, leaving the entity-operator in CrashLoopBackOff so # KafkaTopics/KafkaUsers never reconcile. Set explicit resources so they diff --git a/packages/library/cozy-lib/templates/_barman.tpl b/packages/library/cozy-lib/templates/_barman.tpl index 3b187dda6..649187f9c 100644 --- a/packages/library/cozy-lib/templates/_barman.tpl +++ b/packages/library/cozy-lib/templates/_barman.tpl @@ -4,17 +4,18 @@ cozy-lib.barman.sidecarConfiguration renders a barman-cloud ObjectStore plugin. It carries the two settings the sidecar cannot get right on its own. Resources: the plugin injects the sidecar with no resources, and what that -means depends on the namespace. A tenant with resourceQuotas set carries a -LimitRange (packages/apps/tenant/templates/quota.yaml) that defaults every -container to 128Mi; the sidecar is OOMKilled mid-backup under it, leaving the -ObjectStore healthy and the backup failed. Measured cgroup high-water mark on a -38 MB database is 254 MiB, so 128Mi cannot hold it. A namespace without a -LimitRange, which is cozy-keycloak and any tenant that leaves resourceQuotas -empty, gave the sidecar no requests and no limit at all, so nothing reserved +means depends on the namespace. A tenant whose resourceQuotas bound memory +carries a LimitRange (packages/apps/tenant/templates/quota.yaml) that defaults +every container to 128Mi; the sidecar is OOMKilled mid-backup under it, leaving +the ObjectStore healthy and the backup failed. Measured cgroup high-water mark +on a 38 MB database is 254 MiB, so 128Mi cannot hold it. A namespace without a +LimitRange, which is cozy-keycloak and any tenant whose resourceQuotas bound +none of cpu, memory or ephemeral-storage, gave the sidecar no requests and no +limit at all, so nothing reserved memory for it and nothing bounded it. The same request and limit settle both: 256Mi holds the measured working set and 1Gi is four times the measurement. -The CPU limit is explicit for the same reason: left unset, that LimitRange -gives the sidecar its 250m default, so gzip compression of full backups and +The CPU limit is explicit for the same reason: left unset, a LimitRange under +a cpu quota gives the sidecar its 250m default, so gzip compression of full backups and WAL segments runs on a quarter of a core (a 1.6 GB database took 30 minutes to back up). One core keeps the sidecar from starving the instance while removing that ceiling. Inside a tenant both limits count against the From 8800d0177ba936ff8da5617fd57d03d1276f1d7c Mon Sep 17 00:00:00 2001 From: Andrey Kolkov Date: Mon, 23 Nov 2026 20:52:21 +0700 Subject: [PATCH 3/3] fix(platform): bump system PostgreSQL to 17.12 The system databases (Keycloak, Harbor, Grafana, Alerta, SeaweedFS) are pinned to PostgreSQL 17.7, which is affected by CVE-2026-116331: a type confusion in the min/max aggregate optimisation lets a role that can create objects run code as the operating system user of the server. The 17.x line fixes it in 17.12. Move the pin to 17.12-standard-trixie. The image variant and the Debian release stay the same, so glibc and ICU do not change under the data directory. Clusters on another major keep their image, as before. Assisted-by: LLM Signed-off-by: Andrey Kolkov --- packages/system/harbor/templates/database.yaml | 4 ++-- packages/system/keycloak/templates/db.yaml | 4 ++-- packages/system/monitoring/templates/alerta/alerta-db.yaml | 4 ++-- packages/system/monitoring/templates/grafana/db.yaml | 4 ++-- packages/system/seaweedfs-db/templates/database.yaml | 4 ++-- packages/system/seaweedfs-db/tests/database_test.yaml | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/system/harbor/templates/database.yaml b/packages/system/harbor/templates/database.yaml index 9a9486017..d33f63678 100644 --- a/packages/system/harbor/templates/database.yaml +++ b/packages/system/harbor/templates/database.yaml @@ -6,8 +6,8 @@ metadata: spec: instances: {{ .Values.db.replicas }} {{- $existingCluster := lookup "postgresql.cnpg.io/v1" "Cluster" .Release.Namespace (printf "%s-db" .Values.harbor.fullnameOverride) }} - {{- $image := dig "spec" "imageName" "ghcr.io/cloudnative-pg/postgresql:17.7-standard-trixie" $existingCluster }} - imageName: {{ if regexMatch ":17\\." $image }}ghcr.io/cloudnative-pg/postgresql:17.7-standard-trixie{{ else if regexMatch ":[0-9]+\\.[0-9]+$" $image }}{{ printf "%s-standard-trixie" $image }}{{ else }}{{ $image }}{{ end }} + {{- $image := dig "spec" "imageName" "ghcr.io/cloudnative-pg/postgresql:17.12-standard-trixie" $existingCluster }} + imageName: {{ if regexMatch ":17\\." $image }}ghcr.io/cloudnative-pg/postgresql:17.12-standard-trixie{{ else if regexMatch ":[0-9]+\\.[0-9]+$" $image }}{{ printf "%s-standard-trixie" $image }}{{ else }}{{ $image }}{{ end }} storage: size: {{ .Values.db.size }} {{- with .Values.db.storageClass }} diff --git a/packages/system/keycloak/templates/db.yaml b/packages/system/keycloak/templates/db.yaml index a8f680a6f..b0ebe98a5 100644 --- a/packages/system/keycloak/templates/db.yaml +++ b/packages/system/keycloak/templates/db.yaml @@ -5,8 +5,8 @@ metadata: spec: instances: 2 {{- $existingCluster := lookup "postgresql.cnpg.io/v1" "Cluster" .Release.Namespace "keycloak-db" }} - {{- $image := dig "spec" "imageName" "ghcr.io/cloudnative-pg/postgresql:17.7-standard-trixie" $existingCluster }} - imageName: {{ if regexMatch ":17\\." $image }}ghcr.io/cloudnative-pg/postgresql:17.7-standard-trixie{{ else if regexMatch ":[0-9]+\\.[0-9]+$" $image }}{{ printf "%s-standard-trixie" $image }}{{ else }}{{ $image }}{{ end }} + {{- $image := dig "spec" "imageName" "ghcr.io/cloudnative-pg/postgresql:17.12-standard-trixie" $existingCluster }} + imageName: {{ if regexMatch ":17\\." $image }}ghcr.io/cloudnative-pg/postgresql:17.12-standard-trixie{{ else if regexMatch ":[0-9]+\\.[0-9]+$" $image }}{{ printf "%s-standard-trixie" $image }}{{ else }}{{ $image }}{{ end }} storage: size: 20Gi {{- with .Values.database.affinity }} diff --git a/packages/system/monitoring/templates/alerta/alerta-db.yaml b/packages/system/monitoring/templates/alerta/alerta-db.yaml index af9dc72c5..2bc47af37 100644 --- a/packages/system/monitoring/templates/alerta/alerta-db.yaml +++ b/packages/system/monitoring/templates/alerta/alerta-db.yaml @@ -6,8 +6,8 @@ metadata: spec: instances: 2 {{- $existingCluster := lookup "postgresql.cnpg.io/v1" "Cluster" .Release.Namespace "alerta-db" }} - {{- $image := dig "spec" "imageName" "ghcr.io/cloudnative-pg/postgresql:17.7-standard-trixie" $existingCluster }} - imageName: {{ if regexMatch ":17\\." $image }}ghcr.io/cloudnative-pg/postgresql:17.7-standard-trixie{{ else if regexMatch ":[0-9]+\\.[0-9]+$" $image }}{{ printf "%s-standard-trixie" $image }}{{ else }}{{ $image }}{{ end }} + {{- $image := dig "spec" "imageName" "ghcr.io/cloudnative-pg/postgresql:17.12-standard-trixie" $existingCluster }} + imageName: {{ if regexMatch ":17\\." $image }}ghcr.io/cloudnative-pg/postgresql:17.12-standard-trixie{{ else if regexMatch ":[0-9]+\\.[0-9]+$" $image }}{{ printf "%s-standard-trixie" $image }}{{ else }}{{ $image }}{{ end }} {{- if .Values._cluster.scheduling }} {{- $rawConstraints := get .Values._cluster.scheduling "globalAppTopologySpreadConstraints" }} {{- if $rawConstraints }} diff --git a/packages/system/monitoring/templates/grafana/db.yaml b/packages/system/monitoring/templates/grafana/db.yaml index afc2d0d79..e192ab9f8 100644 --- a/packages/system/monitoring/templates/grafana/db.yaml +++ b/packages/system/monitoring/templates/grafana/db.yaml @@ -5,8 +5,8 @@ metadata: spec: instances: 2 {{- $existingCluster := lookup "postgresql.cnpg.io/v1" "Cluster" .Release.Namespace "grafana-db" }} - {{- $image := dig "spec" "imageName" "ghcr.io/cloudnative-pg/postgresql:17.7-standard-trixie" $existingCluster }} - imageName: {{ if regexMatch ":17\\." $image }}ghcr.io/cloudnative-pg/postgresql:17.7-standard-trixie{{ else if regexMatch ":[0-9]+\\.[0-9]+$" $image }}{{ printf "%s-standard-trixie" $image }}{{ else }}{{ $image }}{{ end }} + {{- $image := dig "spec" "imageName" "ghcr.io/cloudnative-pg/postgresql:17.12-standard-trixie" $existingCluster }} + imageName: {{ if regexMatch ":17\\." $image }}ghcr.io/cloudnative-pg/postgresql:17.12-standard-trixie{{ else if regexMatch ":[0-9]+\\.[0-9]+$" $image }}{{ printf "%s-standard-trixie" $image }}{{ else }}{{ $image }}{{ end }} storage: size: {{ .Values.grafana.db.size }} {{- if .Values._cluster.scheduling }} diff --git a/packages/system/seaweedfs-db/templates/database.yaml b/packages/system/seaweedfs-db/templates/database.yaml index 136a3be83..de6a94a27 100644 --- a/packages/system/seaweedfs-db/templates/database.yaml +++ b/packages/system/seaweedfs-db/templates/database.yaml @@ -6,8 +6,8 @@ metadata: spec: instances: {{ .Values.db.replicas }} {{- $existingCluster := lookup "postgresql.cnpg.io/v1" "Cluster" .Release.Namespace "seaweedfs-db" }} - {{- $image := dig "spec" "imageName" "ghcr.io/cloudnative-pg/postgresql:17.7-standard-trixie" $existingCluster }} - imageName: {{ if regexMatch ":17\\." $image }}ghcr.io/cloudnative-pg/postgresql:17.7-standard-trixie{{ else if regexMatch ":[0-9]+\\.[0-9]+$" $image }}{{ printf "%s-standard-trixie" $image }}{{ else }}{{ $image }}{{ end }} + {{- $image := dig "spec" "imageName" "ghcr.io/cloudnative-pg/postgresql:17.12-standard-trixie" $existingCluster }} + imageName: {{ if regexMatch ":17\\." $image }}ghcr.io/cloudnative-pg/postgresql:17.12-standard-trixie{{ else if regexMatch ":[0-9]+\\.[0-9]+$" $image }}{{ printf "%s-standard-trixie" $image }}{{ else }}{{ $image }}{{ end }} storage: size: {{ .Values.db.size }} {{- with .Values.db.storageClass }} diff --git a/packages/system/seaweedfs-db/tests/database_test.yaml b/packages/system/seaweedfs-db/tests/database_test.yaml index 2e6244cf1..af0e8dc7f 100644 --- a/packages/system/seaweedfs-db/tests/database_test.yaml +++ b/packages/system/seaweedfs-db/tests/database_test.yaml @@ -43,14 +43,14 @@ tests: path: spec.storage.storageClass value: replicated - - it: fresh install pins the default postgres 17.7 image + - it: fresh install pins the default postgres 17.12 image release: name: seaweedfs-db namespace: cozy-seaweedfs asserts: - equal: path: spec.imageName - value: ghcr.io/cloudnative-pg/postgresql:17.7-standard-trixie + value: ghcr.io/cloudnative-pg/postgresql:17.12-standard-trixie - it: carries the apiserver-allow inherited label release: