From 4a7f4b8df545e710dfbf81ca2dc3c9b5d28385b1 Mon Sep 17 00:00:00 2001 From: yerkennz Date: Tue, 17 Feb 2026 12:21:11 +0500 Subject: [PATCH] fix: [CPCAP-7006] adding velero even if it exists --- operator/controllers/patroni_core_controller.go | 3 +++ operator/controllers/postgresservice_controller.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/operator/controllers/patroni_core_controller.go b/operator/controllers/patroni_core_controller.go index 4e678830..fd141d76 100644 --- a/operator/controllers/patroni_core_controller.go +++ b/operator/controllers/patroni_core_controller.go @@ -445,6 +445,9 @@ func (pr *PatroniCoreReconciler) AddExcludeLabelToCm(c client.Client, cmName str } if foundCm.Labels == nil { foundCm.Labels = make(map[string]string) + } + + if foundCm.Labels["velero.io/exclude-from-backup"] != "true" { foundCm.Labels["velero.io/exclude-from-backup"] = "true" err = c.Update(context.TODO(), foundCm) if err != nil { diff --git a/operator/controllers/postgresservice_controller.go b/operator/controllers/postgresservice_controller.go index a633a6cf..53014958 100644 --- a/operator/controllers/postgresservice_controller.go +++ b/operator/controllers/postgresservice_controller.go @@ -598,6 +598,9 @@ func (r *PostgresServiceReconciler) AddExcludeLabelToCm(c client.Client, cmName } if foundCm.Labels == nil { foundCm.Labels = make(map[string]string) + } + + if foundCm.Labels["velero.io/exclude-from-backup"] != "true" { foundCm.Labels["velero.io/exclude-from-backup"] = "true" err = c.Update(context.TODO(), foundCm) if err != nil {