Skip to content

Commit ba70475

Browse files
committed
Add debug logging for cluster-name-suffix label inspection
- Log HTTPRoute/Ingress labels when processing remote cluster items - Log when suffix is applied or not found - Help diagnose why cluster-name-suffix isn't being applied
1 parent dae2b1a commit ba70475

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
@@ -1164,8 +1164,12 @@ func createIngressItem(ingress networkingv1.Ingress, host string, validRuleCount
11641164

11651165
// Append cluster name suffix from label if set (only for remote clusters)
11661166
if clusterName, ok := ingress.ObjectMeta.Annotations["homer.rajsingh.info/cluster"]; ok && clusterName != "" && clusterName != "local" {
1167+
log.Printf("DEBUG: Ingress %s from cluster %s, labels: %v", ingress.ObjectMeta.Name, clusterName, ingress.ObjectMeta.Labels)
11671168
if suffix, hasSuffix := ingress.ObjectMeta.Labels["cluster-name-suffix"]; hasSuffix && suffix != "" {
1169+
log.Printf("DEBUG: Appending suffix %q to name %q", suffix, name)
11681170
name = name + suffix
1171+
} else {
1172+
log.Printf("DEBUG: No cluster-name-suffix label found for %s", ingress.ObjectMeta.Name)
11691173
}
11701174
}
11711175

@@ -1287,8 +1291,12 @@ func updateHomerConfigWithHTTPRoutes(
12871291

12881292
// Append cluster name suffix from label if set (only for remote clusters)
12891293
if clusterName, ok := httproute.ObjectMeta.Annotations["homer.rajsingh.info/cluster"]; ok && clusterName != "" && clusterName != "local" {
1294+
log.Printf("DEBUG: HTTPRoute %s from cluster %s, labels: %v", httproute.ObjectMeta.Name, clusterName, httproute.ObjectMeta.Labels)
12901295
if suffix, hasSuffix := httproute.ObjectMeta.Labels["cluster-name-suffix"]; hasSuffix && suffix != "" {
1296+
log.Printf("DEBUG: Appending suffix %q to name %q", suffix, name)
12911297
name = name + suffix
1298+
} else {
1299+
log.Printf("DEBUG: No cluster-name-suffix label found for %s", httproute.ObjectMeta.Name)
12921300
}
12931301
}
12941302

0 commit comments

Comments
 (0)