Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
87d1756
copy of accepted inference pool test to start from.
SinaChavoshi May 14, 2025
a9dcb62
add yaml file for the test
SinaChavoshi May 14, 2025
c36e5f8
update time out
SinaChavoshi May 14, 2025
aaf23e2
update the yaml file to add port 9002
SinaChavoshi May 14, 2025
2a67e7d
read timeout config from local repo
SinaChavoshi May 14, 2025
8ac7d72
remove excess comments
SinaChavoshi May 14, 2025
66f325d
correct spelling for scenarios
SinaChavoshi May 20, 2025
fd0fa10
check route condition on RouteConditionResolvedRefs
SinaChavoshi May 20, 2025
59b1f9c
Merge branch 'main' into inf_pool_tests_11
SinaChavoshi May 27, 2025
8a078dc
remove empty lines in yaml
SinaChavoshi May 27, 2025
c55a803
set optional/defaulted fields as unspecified
SinaChavoshi May 27, 2025
c6bacb4
Merge branch 'main' into inf_pool_tests_11
SinaChavoshi May 28, 2025
271b7a8
Merge branch 'main' into inf_pool_tests_11
SinaChavoshi May 28, 2025
c92a402
fix timeout
SinaChavoshi May 28, 2025
bb257fd
fix boilerplate header
SinaChavoshi May 28, 2025
5a61a70
change varialbe names to use primary secondary consistently.
SinaChavoshi May 28, 2025
6fa352d
remove extra comments
SinaChavoshi May 28, 2025
5f1bcad
factor out common code
SinaChavoshi May 28, 2025
e5fc860
Add actual http traffic validation using echo-basic
SinaChavoshi May 28, 2025
62791b5
remove extra comments from manifest
SinaChavoshi May 28, 2025
2f08131
remove modifiedTimeoutConfig.HTTPRouteMustHaveCondition per review co…
SinaChavoshi May 28, 2025
fc2a410
Merge remote-tracking branch 'upstream/main'
SinaChavoshi May 29, 2025
d34457a
Merge remote-tracking branch 'upstream/main'
SinaChavoshi Jun 5, 2025
753917a
Merge remote-tracking branch 'upstream/main'
SinaChavoshi Jun 6, 2025
f4bcc9a
Merge branch 'main' into inf_pool_tests_11
SinaChavoshi Jun 6, 2025
d5530dc
Merge remote-tracking branch 'upstream/main'
SinaChavoshi Jun 6, 2025
0ce459c
Merge branch 'main' into inf_pool_tests_11
SinaChavoshi Jun 6, 2025
3b884d6
intermediate update
SinaChavoshi Jun 6, 2025
d90eae0
fix the test run
SinaChavoshi Jun 6, 2025
73731e3
factor out common code
SinaChavoshi Jun 6, 2025
b57fb8a
Merge remote-tracking branch 'upstream/main'
SinaChavoshi Jun 9, 2025
6ee73d5
Merge branch 'main' into inf_pool_tests_11
SinaChavoshi Jun 9, 2025
b239930
move epp def to shared manifest
SinaChavoshi Jun 9, 2025
66b8426
remove extra comments
SinaChavoshi Jun 9, 2025
9432280
revert back to two epps
SinaChavoshi Jun 9, 2025
ad82e88
Merge remote-tracking branch 'upstream/main' into inf_pool_tests_11
SinaChavoshi Jun 13, 2025
04f52f3
add to do for epp image
SinaChavoshi Jun 16, 2025
d6b588e
switch to GeneralMustHaveConditionTimeout
SinaChavoshi Jun 16, 2025
112d878
undo gateway version changes
SinaChavoshi Jun 16, 2025
120feb3
remove unused HTTPRouteMustHaveConditions
SinaChavoshi Jun 16, 2025
8214cdf
update doc string for GetPod
SinaChavoshi Jun 16, 2025
76cb644
update docstring
SinaChavoshi Jun 16, 2025
5dca67b
Remove resource type from names in manifests.
SinaChavoshi Jun 16, 2025
f2c0602
remove type from name
SinaChavoshi Jun 17, 2025
daeb8e6
remove health check
SinaChavoshi Jun 17, 2025
f1ab79f
Merge remote-tracking branch 'upstream/main' into inf_pool_tests_11
SinaChavoshi Jun 17, 2025
81562a2
add todo for combining getpod methods
SinaChavoshi Jun 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 90 additions & 14 deletions conformance/resources/manifests/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,45 @@
# individual test files or other resource directories (e.g., sample_backends).

---
# Namespace for core infrastructure like Gateways.
apiVersion: v1
kind: Namespace
metadata:
name: gateway-conformance-infra
labels:
gateway-conformance: infra
---
# Namespace for application backends (potentially simulating model servers
# or where InferencePools might reside in some tests).
apiVersion: v1
kind: Namespace
metadata:
name: gateway-conformance-app-backend
labels:
gateway-conformance: backend
---
# Namespace for simple web server backends. This is expected by
# the upstream conformance suite's Setup method.
apiVersion: v1
kind: Namespace
metadata:
name: gateway-conformance-web-backend
labels:
gateway-conformance: web-backend
---
# A basic Gateway resource that allows HTTPRoutes from the same namespace.
# Tests can use this as a parent reference for routes that target InferencePools.
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: conformance-gateway
namespace: gateway-conformance-infra
spec:
# The conformance suite runner will replace this placeholder
# with the actual GatewayClass name provided via flags.
gatewayClassName: "{GATEWAY_CLASS_NAME}"
listeners:
- name: http # Standard listener name
- name: http
port: 80
protocol: HTTP
allowedRoutes:
namespaces:
from: All
kinds:
# Allows HTTPRoutes to attach, which can then reference InferencePools.
- group: gateway.networking.k8s.io
kind: HTTPRoute
---
# --- Conformance Secondary Gateway Definition ---
# A second generic Gateway resource for tests requiring multiple Gateways.
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
Expand All @@ -66,7 +54,95 @@ spec:
- name: http
port: 80
protocol: HTTP
hostname: "secondary.example.com" # Distinct hostname to differentiate from conformance-gateway
hostname: "secondary.example.com"
allowedRoutes:
namespaces:
from: All
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: inference-model-1
namespace: gateway-conformance-app-backend
labels:
app: inference-model-1
spec:
replicas: 1
selector:
matchLabels:
app: inference-model-1
template:
metadata:
labels:
app: inference-model-1
spec:
containers:
- name: echo-basic-1
image: gcr.io/k8s-staging-gateway-api/echo-basic:v20240412-v1.0.0-394-g40c666fd
ports:
- name: http
containerPort: 3000
readinessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 3
periodSeconds: 5
failureThreshold: 2
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
Comment on lines +93 to +96
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Is POD_NAME being used? If not, stick with NAMESPACE and POD_IP only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used in traffic.go MakeRequestAndExpectResponseFromPod() to validate the http response is from the specified pod. Current logic uses a label to get the primary/secondary pod that is then passed down to MakeRequestAndExpectResponseFromPod which contains the pod name, this then used to validate the response. It is possible to use the pod IP though, I believe having pod name makes debugging easier. If this is a strong requirement let me know and I can switch to using IP only.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ is my understanding as well. As you state, pod labels and pod name are being used and not the POD_NAME environment variable. It's harmless to set the POD_NAME environment variable here so this comment is not a PR blocker.

- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: inference-model-2
namespace: gateway-conformance-app-backend
labels:
app: inference-model-2
spec:
replicas: 1
selector:
matchLabels:
app: inference-model-2
template:
metadata:
labels:
app: inference-model-2
spec:
containers:
- name: echo-basic-2
image: gcr.io/k8s-staging-gateway-api/echo-basic:v20240412-v1.0.0-394-g40c666fd
ports:
- name: http
containerPort: 3000
readinessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 3
periodSeconds: 5
failureThreshold: 2
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
Copyright 2025 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package basic

import (
"testing"

"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
"sigs.k8s.io/gateway-api/pkg/features"

"sigs.k8s.io/gateway-api-inference-extension/conformance/tests"
k8sutils "sigs.k8s.io/gateway-api-inference-extension/conformance/utils/kubernetes"
trafficutils "sigs.k8s.io/gateway-api-inference-extension/conformance/utils/traffic"
)

func init() {
tests.ConformanceTests = append(tests.ConformanceTests, HTTPRouteMultipleRulesDifferentPools)
}

var HTTPRouteMultipleRulesDifferentPools = suite.ConformanceTest{
ShortName: "HTTPRouteMultipleRulesDifferentPools",
Description: "An HTTPRoute with two rules routing to two different InferencePools",
Manifests: []string{"tests/basic/inferencepool_multiple_rules_different_pools.yaml"},
Features: []features.FeatureName{
features.SupportGateway,
features.SupportHTTPRoute,
features.FeatureName("SupportInferencePool"),
},
Test: func(t *testing.T, s *suite.ConformanceTestSuite) {
const (
appBackendNamespace = "gateway-conformance-app-backend"
infraNamespace = "gateway-conformance-infra"

poolPrimaryName = "pool-primary"
poolSecondaryName = "pool-secondary"
routeName = "httproute-multiple-rules-different-pools"
gatewayName = "conformance-gateway"

backendPrimaryLabelValue = "inference-model-1"
backendSecondaryLabelValue = "inference-model-2"
backendAppLabelKey = "app"

primaryPath = "/primary"
secondaryPath = "/secondary"
)

primaryPoolNN := types.NamespacedName{Name: poolPrimaryName, Namespace: appBackendNamespace}
secondaryPoolNN := types.NamespacedName{Name: poolSecondaryName, Namespace: appBackendNamespace}
routeNN := types.NamespacedName{Name: routeName, Namespace: appBackendNamespace}
gatewayNN := types.NamespacedName{Name: gatewayName, Namespace: infraNamespace}

t.Run("Wait for resources to be accepted", func(t *testing.T) {
k8sutils.HTTPRouteAndInferencePoolMustBeAcceptedAndRouteAccepted(t, s.Client, routeNN, gatewayNN, primaryPoolNN)
k8sutils.HTTPRouteAndInferencePoolMustBeAcceptedAndRouteAccepted(t, s.Client, routeNN, gatewayNN, secondaryPoolNN)
})

t.Run("Traffic should be routed to the correct pool based on path", func(t *testing.T) {
primarySelector := labels.SelectorFromSet(labels.Set{backendAppLabelKey: backendPrimaryLabelValue})
secondarySelector := labels.SelectorFromSet(labels.Set{backendAppLabelKey: backendSecondaryLabelValue})

primaryPod := k8sutils.GetPod(t, s.Client, appBackendNamespace, primarySelector, s.TimeoutConfig.RequestTimeout)
secondaryPod := k8sutils.GetPod(t, s.Client, appBackendNamespace, secondarySelector, s.TimeoutConfig.RequestTimeout)

gwAddr := k8sutils.GetGatewayEndpoint(t, s.Client, s.TimeoutConfig, gatewayNN)

t.Run("request to primary pool", func(t *testing.T) {
trafficutils.MakeRequestAndExpectResponseFromPod(t, s.RoundTripper, s.TimeoutConfig, gwAddr, primaryPath, primaryPod)
})

t.Run("request to secondary pool", func(t *testing.T) {
trafficutils.MakeRequestAndExpectResponseFromPod(t, s.RoundTripper, s.TimeoutConfig, gwAddr, secondaryPath, secondaryPod)
})
})
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
---
apiVersion: v1
kind: Service
metadata:
name: pool-primary-epp
namespace: gateway-conformance-app-backend
spec:
selector:
app: pool-primary-epp
ports:
- name: grpc
port: 9002
targetPort: 9002
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: pool-primary-epp
namespace: gateway-conformance-app-backend
labels:
app: pool-primary-epp
spec:
replicas: 1
selector:
matchLabels:
app: pool-primary-epp
template:
metadata:
labels:
app: pool-primary-epp
spec:
containers:
- name: epp
# TODO(#996) Switch to use a released version of the image instead of epp:main
image: us-central1-docker.pkg.dev/k8s-staging-images/gateway-api-inference-extension/epp:main
imagePullPolicy: Always
env:
- name: ENABLE_REQ_HEADER_BASED_SCHEDULER_FOR_TESTING
value: "true"
args:
- "-poolName"
- "pool-primary"
- "-poolNamespace"
- "gateway-conformance-app-backend"
- -grpcPort
- "9002"
- -grpcHealthPort
- "9003"
---
apiVersion: v1
kind: Service
metadata:
name: pool-secondary-epp
namespace: gateway-conformance-app-backend
spec:
selector:
app: pool-secondary-epp
ports:
- name: grpc
port: 9002
targetPort: 9002
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: pool-secondary-epp
namespace: gateway-conformance-app-backend
labels:
app: pool-secondary-epp
spec:
replicas: 1
selector:
matchLabels:
app: pool-secondary-epp
template:
metadata:
labels:
app: pool-secondary-epp
spec:
containers:
- name: epp
image: us-central1-docker.pkg.dev/k8s-staging-images/gateway-api-inference-extension/epp:main
imagePullPolicy: Always
env:
- name: ENABLE_REQ_HEADER_BASED_SCHEDULER_FOR_TESTING
value: "true"
args:
- "-poolName"
- "pool-secondary"
- "-poolNamespace"
- "gateway-conformance-app-backend"
- -grpcPort
- "9002"
- -grpcHealthPort
- "9003"
---
apiVersion: inference.networking.x-k8s.io/v1alpha2
kind: InferencePool
metadata:
name: pool-primary
namespace: gateway-conformance-app-backend
spec:
selector:
app: inference-model-1
targetPortNumber: 3000
extensionRef:
name: pool-primary-epp
portNumber: 9002
---
apiVersion: inference.networking.x-k8s.io/v1alpha2
kind: InferencePool
metadata:
name: pool-secondary
namespace: gateway-conformance-app-backend
spec:
selector:
app: inference-model-2
targetPortNumber: 3000
extensionRef:
name: pool-secondary-epp
portNumber: 9002
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: httproute-multiple-rules-different-pools
namespace: gateway-conformance-app-backend
spec:
parentRefs:
- name: conformance-gateway
namespace: gateway-conformance-infra
rules:
- matches:
- path:
type: PathPrefix
value: /primary
backendRefs:
- name: pool-primary
kind: InferencePool
group: inference.networking.x-k8s.io
port: 80
- matches:
- path:
type: PathPrefix
value: /secondary
backendRefs:
- name: pool-secondary
kind: InferencePool
group: inference.networking.x-k8s.io
port: 80
Loading