Skip to content

Commit d408ea8

Browse files
committed
tg constructor unit tests + bug fixes
1 parent 33bde7e commit d408ea8

File tree

2 files changed

+666
-3
lines changed

2 files changed

+666
-3
lines changed

pkg/gateway/tg_config_constructor.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,23 @@ func (t *targetGroupConfigConstructorImpl) mergeWithLongestMatch(initialCfg *elb
4040
break
4141
}
4242

43-
if kindEquals && nsEquals && kindNsRank > longestMatch {
43+
idHasName := routeConfig.RouteIdentifier.RouteName != ""
44+
idHasNamespace := routeConfig.RouteIdentifier.RouteNamespace != ""
45+
46+
if idHasName {
47+
continue
48+
}
49+
50+
if (kindEquals && nsEquals) && kindNsRank > longestMatch {
4451
// Partial match kind:ns
4552
matched = &routeConfig.TargetGroupProps
4653
longestMatch = kindNsRank
47-
} else if kindEquals && kindRank > longestMatch {
54+
} else if (kindEquals && !idHasNamespace) && kindRank > longestMatch {
4855
// Partial match kind
4956
matched = &routeConfig.TargetGroupProps
5057
longestMatch = kindRank
5158
}
5259
}
53-
5460
return t.merge(matched, initialCfg)
5561
}
5662

0 commit comments

Comments
 (0)