Skip to content

Commit

Permalink
GH-3406 - Only error for config entries from different datacenters wh…
Browse files Browse the repository at this point in the history
…en the config entries are different
  • Loading branch information
jmurret committed Apr 19, 2024
1 parent 6dfbadf commit 481551d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -236,15 +237,15 @@ 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))
}

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
Expand Down

0 comments on commit 481551d

Please sign in to comment.