From f80c7fcd44b0326918b3c84393e851969c0012ee Mon Sep 17 00:00:00 2001 From: Philipp Eberle Date: Fri, 24 Oct 2025 15:14:20 +0200 Subject: [PATCH 1/2] Add a version label to the spilo pods (which might break / complicate inplace upgrades) --- api/v1/postgres_types.go | 4 ++++ pkg/operatormanager/operatormanager.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/api/v1/postgres_types.go b/api/v1/postgres_types.go index c3c9b9b1..915c4918 100644 --- a/api/v1/postgres_types.go +++ b/api/v1/postgres_types.go @@ -62,6 +62,8 @@ const ( StandbyMethod = "streaming_host" // PartitionIDLabelName Name of the managed-by label PartitionIDLabelName string = "postgres.database.fits.cloud/partition-id" + // PostgresVersionLabelName Name of the version label + PostgresVersionLabelName string = "postgres.database.fits.cloud/version" ApplicationLabelName = "application" ApplicationLabelValue = "spilo" @@ -679,6 +681,8 @@ func (p *Postgres) ToUnstructuredZalandoPostgresql(z *zalando.Postgresql, c *cor // Add the newly introduced label only here, not in p.ToZalandoPostgresqlMatchingLabels() (so that the selectors using p.ToZalandoPostgresqlMatchingLabels() will still work until all postgres resources have that new label) // TODO once all the custom resources have that new label, move this part to p.ToZalandoPostgresqlMatchingLabels() z.Labels[PartitionIDLabelName] = p.Spec.PartitionID + // Add the additional version label to the custom resource + z.Labels[PostgresVersionLabelName] = p.Spec.Version if image != "" { z.Spec.DockerImage = image diff --git a/pkg/operatormanager/operatormanager.go b/pkg/operatormanager/operatormanager.go index c3f592d6..98dd2cb2 100644 --- a/pkg/operatormanager/operatormanager.go +++ b/pkg/operatormanager/operatormanager.go @@ -417,7 +417,7 @@ func (m *OperatorManager) editConfigMap(cm *corev1.ConfigMap, namespace string, // set the reference to our custom pod environment secret cm.Data["pod_environment_secret"] = PodEnvSecretName // set the list of inherited labels that will be passed on to the pods - s := []string{pg.TenantLabelName, pg.ProjectIDLabelName, pg.UIDLabelName, pg.NameLabelName, pg.PartitionIDLabelName} + s := []string{pg.TenantLabelName, pg.ProjectIDLabelName, pg.UIDLabelName, pg.NameLabelName, pg.PartitionIDLabelName, pg.PostgresVersionLabelName} // TODO maybe use a precompiled string here cm.Data["inherited_labels"] = strings.Join(s, ",") From b3abeb5fed8fa3599ddd5484cb49f76bd5b5b6f6 Mon Sep 17 00:00:00 2001 From: Philipp Eberle Date: Fri, 24 Oct 2025 15:42:24 +0200 Subject: [PATCH 2/2] Add comment --- main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/main.go b/main.go index ba5294be..62dce4b9 100644 --- a/main.go +++ b/main.go @@ -254,6 +254,7 @@ func main() { pgParamBlockList[blockedParam] = true } + // be careful changing this value if you also set the pg.PostgresVersionLabelName inherited_label viper.SetDefault(majorVersionUpgradeModeFlg, "manual") majorVersionUpgradeMode = viper.GetString(majorVersionUpgradeModeFlg)