Skip to content

Commit ef615c1

Browse files
committed
include cluster name in Source field for unique conflict detection
Items from different remote clusters with the same name/namespace were being treated as duplicates. Now Source includes cluster name (e.g. 'code@ottawa' vs 'code@robbinsdale') to uniquely identify them.
1 parent 0ca8f52 commit ef615c1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/homer/config.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,11 @@ func createIngressItem(ingress networkingv1.Ingress, host string, validRuleCount
11951195
}
11961196

11971197
// Set metadata for conflict detection
1198+
// For remote clusters, include cluster name in Source to make it unique
11981199
item.Source = ingress.ObjectMeta.Name
1200+
if clusterName, ok := ingress.ObjectMeta.Annotations["homer.rajsingh.info/cluster"]; ok && clusterName != "" && clusterName != "local" {
1201+
item.Source = ingress.ObjectMeta.Name + "@" + clusterName
1202+
}
11991203
item.Namespace = ingress.ObjectMeta.Namespace
12001204
item.LastUpdate = ingress.ObjectMeta.CreationTimestamp.Time.Format("2006-01-02T15:04:05Z")
12011205

@@ -1302,7 +1306,11 @@ func updateHomerConfigWithHTTPRoutes(
13021306
setItemParameter(&item, "name", name)
13031307

13041308
// Set metadata for conflict detection
1309+
// For remote clusters, include cluster name in Source to make it unique
13051310
item.Source = httproute.ObjectMeta.Name
1311+
if clusterName, ok := httproute.ObjectMeta.Annotations["homer.rajsingh.info/cluster"]; ok && clusterName != "" && clusterName != "local" {
1312+
item.Source = httproute.ObjectMeta.Name + "@" + clusterName
1313+
}
13061314
item.Namespace = httproute.ObjectMeta.Namespace
13071315
item.LastUpdate = httproute.ObjectMeta.CreationTimestamp.Time.Format("2006-01-02T15:04:05Z")
13081316

0 commit comments

Comments
 (0)