Skip to content

Commit 2d7613c

Browse files
authored
Conformance: Adds InferenceObjective Request Header (#1353)
Signed-off-by: Daneyon Hansen <[email protected]>
1 parent 671ac4c commit 2d7613c

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

conformance/tests/epp_unavailable_fail_open.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"sigs.k8s.io/gateway-api-inference-extension/conformance/utils/config"
3030
k8sutils "sigs.k8s.io/gateway-api-inference-extension/conformance/utils/kubernetes"
3131
trafficutils "sigs.k8s.io/gateway-api-inference-extension/conformance/utils/traffic"
32+
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/metadata"
3233
testfilter "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework/plugins/test/filter"
3334
)
3435

@@ -53,6 +54,7 @@ var EppUnAvailableFailOpen = suite.ConformanceTest{
5354
"model": "conformance-fake-model",
5455
"prompt": "Write as if you were a critic: San Francisco"
5556
}`
57+
inferenceObjName = "conformance-fake-model-server"
5658
)
5759

5860
httpRouteNN := types.NamespacedName{Name: "httproute-for-failopen-pool-gw", Namespace: resources.AppBackendNamespace}
@@ -75,9 +77,12 @@ var EppUnAvailableFailOpen = suite.ConformanceTest{
7577
s.TimeoutConfig,
7678
gwAddr,
7779
trafficutils.Request{
78-
Host: hostname,
79-
Path: path,
80-
Headers: map[string]string{testfilter.HeaderTestEppEndPointSelectionKey: targetPodIP},
80+
Host: hostname,
81+
Path: path,
82+
Headers: map[string]string{
83+
testfilter.HeaderTestEppEndPointSelectionKey: targetPodIP,
84+
metadata.ObjectiveKey: inferenceObjName,
85+
},
8186
Method: http.MethodPost,
8287
Body: requestBody,
8388
Backend: pods[0].Name, // Make sure the request is from the targetPod when the EPP is alive.
@@ -100,9 +105,12 @@ var EppUnAvailableFailOpen = suite.ConformanceTest{
100105
s.TimeoutConfig,
101106
gwAddr,
102107
trafficutils.Request{
103-
Host: hostname,
104-
Path: path,
105-
Headers: map[string]string{testfilter.HeaderTestEppEndPointSelectionKey: targetPodIP},
108+
Host: hostname,
109+
Path: path,
110+
Headers: map[string]string{
111+
testfilter.HeaderTestEppEndPointSelectionKey: targetPodIP,
112+
metadata.ObjectiveKey: inferenceObjName,
113+
},
106114
Method: http.MethodPost,
107115
Body: requestBody,
108116
Backend: appPodBackendPrefix, // Only checks the prefix since the EPP is not alive and the response can return from any Pod.

conformance/tests/gateway_following_epp_routing.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"sigs.k8s.io/gateway-api-inference-extension/conformance/resources"
3434
k8sutils "sigs.k8s.io/gateway-api-inference-extension/conformance/utils/kubernetes"
3535
"sigs.k8s.io/gateway-api-inference-extension/conformance/utils/traffic"
36+
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/metadata"
3637
testfilter "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework/plugins/test/filter"
3738
)
3839

@@ -54,6 +55,7 @@ var GatewayFollowingEPPRouting = suite.ConformanceTest{
5455
hostname = "primary.example.com"
5556
path = "/primary-gateway-test"
5657
appPodBackendPrefix = "primary-inference-model-server"
58+
inferenceObjName = "conformance-fake-model-server"
5759
)
5860

5961
httpRouteNN := types.NamespacedName{Name: "httproute-for-primary-gw", Namespace: resources.AppBackendNamespace}
@@ -92,9 +94,12 @@ var GatewayFollowingEPPRouting = suite.ConformanceTest{
9294
s.TimeoutConfig,
9395
gwAddr,
9496
traffic.Request{
95-
Host: hostname,
96-
Path: path,
97-
Headers: map[string]string{testfilter.HeaderTestEppEndPointSelectionKey: podIPs[i]},
97+
Host: hostname,
98+
Path: path,
99+
Headers: map[string]string{
100+
testfilter.HeaderTestEppEndPointSelectionKey: podIPs[i],
101+
metadata.ObjectiveKey: inferenceObjName,
102+
},
98103
Method: http.MethodPost,
99104
Body: requestBody,
100105
Backend: podNames[i],
@@ -128,7 +133,10 @@ var GatewayFollowingEPPRouting = suite.ConformanceTest{
128133
for _, tc := range testCases {
129134
t.Run(tc.name, func(t *testing.T) {
130135
eppHeaderValue := strings.Join(tc.podIPsToBeReturnedByEPP, ",")
131-
headers := map[string]string{testfilter.HeaderTestEppEndPointSelectionKey: eppHeaderValue}
136+
headers := map[string]string{
137+
testfilter.HeaderTestEppEndPointSelectionKey: eppHeaderValue,
138+
metadata.ObjectiveKey: inferenceObjName,
139+
}
132140

133141
t.Logf("Sending request to %s with EPP header '%s: %s'", gwAddr, testfilter.HeaderTestEppEndPointSelectionKey, eppHeaderValue)
134142
t.Logf("Expecting traffic to be routed to pod: %v", tc.expectAllRequestsRoutedWithinPodNames)

0 commit comments

Comments
 (0)