From 481551d533afb5e0fd662e21d35c4436a542d7d2 Mon Sep 17 00:00:00 2001 From: John Murret Date: Wed, 3 Apr 2024 17:49:16 -0600 Subject: [PATCH] GH-3406 - Only error for config entries from different datacenters when the config entries are different --- .../controllers/configentries/configentry_controller.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/control-plane/controllers/configentries/configentry_controller.go b/control-plane/controllers/configentries/configentry_controller.go index 9e9459308f..e739387a30 100644 --- a/control-plane/controllers/configentries/configentry_controller.go +++ b/control-plane/controllers/configentries/configentry_controller.go @@ -225,6 +225,7 @@ func (r *ConfigEntryController) ReconcileEntry(ctx context.Context, crdCtrl Cont requiresMigration := false sourceDatacenter := entry.GetMeta()[common.DatacenterKey] + matchesConsul := configEntry.MatchesConsul(entry) // Check if the config entry is managed by our datacenter. // Do not process resource if the entry was not created within our datacenter @@ -236,7 +237,7 @@ func (r *ConfigEntryController) ReconcileEntry(ctx context.Context, crdCtrl Cont // This functionality exists to help folks who are upgrading from older helm // chart versions where they had previously created config entries themselves but // now want to manage them through custom resources. - if configEntry.GetObjectMeta().Annotations[common.MigrateEntryKey] != common.MigrateEntryTrue { + if !matchesConsul && configEntry.GetObjectMeta().Annotations[common.MigrateEntryKey] != common.MigrateEntryTrue { return r.syncFailed(ctx, logger, crdCtrl, configEntry, ExternallyManagedConfigError, sourceDatacenterMismatchErr(sourceDatacenter)) } @@ -244,7 +245,7 @@ func (r *ConfigEntryController) ReconcileEntry(ctx context.Context, crdCtrl Cont requiresMigration = true } - if !configEntry.MatchesConsul(entry) { + if !matchesConsul { if requiresMigration { // If we're migrating this config entry but the custom resource // doesn't match what's in Consul currently we error out so that