Skip to content

Commit ebae18d

Browse files
committed
Address feedback
1 parent 35fc68a commit ebae18d

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

internal/controller/nginx/config/servers.go

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ func createInternalLocationsForRule(
634634
}
635635
}
636636

637-
// skip adding match and creating split clients location if its a duplicate intEPPLocation.Path
637+
// skip adding match and creating split clients location if it's a duplicate intEPPLocation.Path
638638
if skipMatch {
639639
continue
640640
}
@@ -973,19 +973,33 @@ func initializeInternalInferenceEPPLocation(
973973
) http.Location {
974974
return http.Location{
975975
// This path needs to be recreated in the split_clients directive generation to match correctly.
976-
Path: fmt.Sprintf(
977-
"%s-%s-%s-%s-routeRule%d-pathRule%d",
978-
http.InternalRoutePathPrefix,
976+
Path: generateInternalInferenceEPPLocationPath(
979977
b.UpstreamName,
980-
source.Namespace,
981-
source.Name,
978+
source,
982979
ruleIdx,
983980
pathruleIdx,
984981
),
985982
Type: http.InferenceInternalLocationType,
986983
}
987984
}
988985

986+
func generateInternalInferenceEPPLocationPath(
987+
upstreamName string,
988+
source types.NamespacedName,
989+
ruleIdx int,
990+
pathRuleIdx int,
991+
) string {
992+
return fmt.Sprintf(
993+
"%s-%s-%s-%s-routeRule%d-pathRule%d",
994+
http.InternalRoutePathPrefix,
995+
upstreamName,
996+
source.Namespace,
997+
source.Name,
998+
ruleIdx,
999+
pathRuleIdx,
1000+
)
1001+
}
1002+
9891003
// initializeInternalInferenceProxyPassLocation initializes the internal inference location that does the final
9901004
// proxy_pass to the inference backend.
9911005
func initializeInternalInferenceProxyPassLocation(pathruleIdx, matchRuleIdx, backendIdx int) http.Location {

internal/controller/nginx/config/split_clients.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,9 @@ func createBackendGroupSplitClientDistributions(group dataplane.BackendGroup) []
187187
func getSplitClientValue(b dataplane.Backend, source types.NamespacedName, ruleIdx, pathRuleIdx int) string {
188188
if b.Valid {
189189
if b.EndpointPickerConfig != nil {
190-
return fmt.Sprintf(
191-
"%s-%s-%s-%s-routeRule%d-pathRule%d",
192-
http.InternalRoutePathPrefix,
190+
return generateInternalInferenceEPPLocationPath(
193191
b.UpstreamName,
194-
source.Namespace,
195-
source.Name,
192+
source,
196193
ruleIdx,
197194
pathRuleIdx,
198195
)

internal/controller/state/dataplane/types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ type BackendGroup struct {
311311
Backends []Backend
312312
// RuleIdx is the index of the corresponding rule in the HTTPRoute.
313313
RuleIdx int
314-
// PathRuleIdx is the index of the corresponding path rule in the HTTPRoute.
314+
// PathRuleIdx is the index of the corresponding path rule when attached to a VirtualServer.
315+
// BackendGroups attached to a MatchRule that have the same Path match will have the same PathRuleIdx.
315316
PathRuleIdx int
316317
}
317318

0 commit comments

Comments
 (0)