Skip to content

Commit 0bf576c

Browse files
committed
update based on reviews
1 parent a939452 commit 0bf576c

File tree

6 files changed

+20
-561
lines changed

6 files changed

+20
-561
lines changed

cmd/gateway/endpoint_picker.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,11 @@ func buildHeaderRequest(r *http.Request) *extprocv3.ProcessingRequest {
154154

155155
for key, values := range r.Header {
156156
for _, value := range values {
157-
// Normalize header keys to lowercase for case-insensitive matching
158-
// This fixes the issue where Go's HTTP header normalization (Title-Case)
159-
// doesn't match EPP's expected lowercase header keys
157+
// Normalize header keys to lowercase for case-insensitive matching.
158+
// This addresses the mismatch between Go's default HTTP header normalization (Title-Case)
159+
// and EPP's expectation of lowercase header keys. Additionally, HTTP/2 — which gRPC uses —
160+
// requires all header field names to be lowercase as specified in RFC 7540, Section 8.1.2:
161+
// https://datatracker.ietf.org/doc/html/rfc7540#section-8.1.2
160162
normalizedKey := strings.ToLower(key)
161163

162164
headerMap.Headers = append(headerMap.Headers, &corev3.HeaderValue{

internal/controller/nginx/config/maps.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func createAddHeadersMap(name string) shared.Map {
183183
}
184184
}
185185

186-
// buildInferenceMaps creates maps for InferencePool back-ends.
186+
// buildInferenceMaps creates maps for InferencePool Backends.
187187
func buildInferenceMaps(groups []dataplane.BackendGroup) []shared.Map {
188188
inferenceMaps := make([]shared.Map, 0, len(groups))
189189

internal/controller/nginx/config/servers.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const (
2828
// HeaderMatchSeparator is the separator for constructing header-based match for NJS.
2929
HeaderMatchSeparator = ":"
3030
rootPath = "/"
31-
svcClusterLocal = ".svc.cluster.local"
3231
)
3332

3433
var grpcAuthorityHeader = http.Header{
@@ -461,7 +460,7 @@ func createInternalLocationsForRule(
461460
}
462461
intInfLocation.EPPInternalPath = intLocation.Path
463462
if b.EndpointPickerConfig.NsName != "" {
464-
intInfLocation.EPPHost = string(eppRef.Name) + "." + b.EndpointPickerConfig.NsName + svcClusterLocal
463+
intInfLocation.EPPHost = string(eppRef.Name) + "." + b.EndpointPickerConfig.NsName
465464
} else {
466465
intInfLocation.EPPHost = string(eppRef.Name)
467466
}
@@ -521,7 +520,7 @@ func createInferenceLocationsForRule(
521520
}
522521
extLocations[i].EPPInternalPath = intLocation.Path
523522
if b.EndpointPickerConfig.NsName != "" {
524-
extLocations[i].EPPHost = string(eppRef.Name) + "." + b.EndpointPickerConfig.NsName + svcClusterLocal
523+
extLocations[i].EPPHost = string(eppRef.Name) + "." + b.EndpointPickerConfig.NsName
525524
} else {
526525
extLocations[i].EPPHost = string(eppRef.Name)
527526
}

internal/controller/nginx/config/servers_template.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,16 @@ server {
124124
{{- end }}
125125
126126
{{- if contains $l.Type "inference" -}}
127-
if ($request_method = GET) {
128-
set $inference_workload_endpoint "";
129-
rewrite ^ {{ $l.EPPInternalPath }} last;
130-
}
131-
132-
js_var $inference_workload_endpoint;
133-
set $epp_internal_path {{ $l.EPPInternalPath }};
134-
set $epp_host {{ $l.EPPHost }};
135-
set $epp_port {{ $l.EPPPort }};
136-
js_content epp.getEndpoint;
137-
break;
127+
if ($request_method = GET) {
128+
set $inference_workload_endpoint "";
129+
rewrite ^ {{ $l.EPPInternalPath }} last;
130+
}
131+
132+
js_var $inference_workload_endpoint;
133+
set $epp_internal_path {{ $l.EPPInternalPath }};
134+
set $epp_host {{ $l.EPPHost }};
135+
set $epp_port {{ $l.EPPPort }};
136+
js_content epp.getEndpoint;
138137
{{- end }}
139138
140139
{{ $proxyOrGRPC := "proxy" }}{{ if $l.GRPC }}{{ $proxyOrGRPC = "grpc" }}{{ end }}

tests/conformance/conformance_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@ import (
2222
"testing"
2323

2424
. "github.com/onsi/gomega"
25-
"gopkg.in/yaml.v2"
25+
inference_conformance "sigs.k8s.io/gateway-api-inference-extension/conformance"
2626
v1 "sigs.k8s.io/gateway-api/apis/v1"
2727
"sigs.k8s.io/gateway-api/apis/v1beta1"
2828
"sigs.k8s.io/gateway-api/conformance"
2929
conf_v1 "sigs.k8s.io/gateway-api/conformance/apis/v1"
3030
"sigs.k8s.io/gateway-api/conformance/tests"
3131
"sigs.k8s.io/gateway-api/conformance/utils/flags"
3232
"sigs.k8s.io/gateway-api/conformance/utils/suite"
33-
34-
inference_conformance "sigs.k8s.io/gateway-api-inference-extension/conformance"
33+
"sigs.k8s.io/yaml"
3534
)
3635

3736
const (
@@ -92,7 +91,6 @@ func TestConformance(t *testing.T) {
9291
}
9392

9493
func TestInferenceExtensionConformance(t *testing.T) {
95-
9694
t.Logf(`Running inference conformance tests with %s GatewayClass\n cleanup: %t\n`+
9795
`debug: %t\n enable all features: %t \n supported extended features: [%v]\n exempt features: [%v]\n`+
9896
`skip tests: [%v]`,

0 commit comments

Comments
 (0)