generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 195
feat(conformance): Add HTTPRouteMultipleRulesDifferentPools test #834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
k8s-ci-robot
merged 47 commits into
kubernetes-sigs:main
from
SinaChavoshi:inf_pool_tests_11
Jun 17, 2025
Merged
Changes from 6 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 a9dcb62
add yaml file for the test
SinaChavoshi c36e5f8
update time out
SinaChavoshi aaf23e2
update the yaml file to add port 9002
SinaChavoshi 2a67e7d
read timeout config from local repo
SinaChavoshi 8ac7d72
remove excess comments
SinaChavoshi 66f325d
correct spelling for scenarios
SinaChavoshi fd0fa10
check route condition on RouteConditionResolvedRefs
SinaChavoshi 59b1f9c
Merge branch 'main' into inf_pool_tests_11
SinaChavoshi 8a078dc
remove empty lines in yaml
SinaChavoshi c55a803
set optional/defaulted fields as unspecified
SinaChavoshi c6bacb4
Merge branch 'main' into inf_pool_tests_11
SinaChavoshi 271b7a8
Merge branch 'main' into inf_pool_tests_11
SinaChavoshi c92a402
fix timeout
SinaChavoshi bb257fd
fix boilerplate header
SinaChavoshi 5a61a70
change varialbe names to use primary secondary consistently.
SinaChavoshi 6fa352d
remove extra comments
SinaChavoshi 5f1bcad
factor out common code
SinaChavoshi e5fc860
Add actual http traffic validation using echo-basic
SinaChavoshi 62791b5
remove extra comments from manifest
SinaChavoshi 2f08131
remove modifiedTimeoutConfig.HTTPRouteMustHaveCondition per review co…
SinaChavoshi fc2a410
Merge remote-tracking branch 'upstream/main'
SinaChavoshi d34457a
Merge remote-tracking branch 'upstream/main'
SinaChavoshi 753917a
Merge remote-tracking branch 'upstream/main'
SinaChavoshi f4bcc9a
Merge branch 'main' into inf_pool_tests_11
SinaChavoshi d5530dc
Merge remote-tracking branch 'upstream/main'
SinaChavoshi 0ce459c
Merge branch 'main' into inf_pool_tests_11
SinaChavoshi 3b884d6
intermediate update
SinaChavoshi d90eae0
fix the test run
SinaChavoshi 73731e3
factor out common code
SinaChavoshi b57fb8a
Merge remote-tracking branch 'upstream/main'
SinaChavoshi 6ee73d5
Merge branch 'main' into inf_pool_tests_11
SinaChavoshi b239930
move epp def to shared manifest
SinaChavoshi 66b8426
remove extra comments
SinaChavoshi 9432280
revert back to two epps
SinaChavoshi ad82e88
Merge remote-tracking branch 'upstream/main' into inf_pool_tests_11
SinaChavoshi 04f52f3
add to do for epp image
SinaChavoshi d6b588e
switch to GeneralMustHaveConditionTimeout
SinaChavoshi 112d878
undo gateway version changes
SinaChavoshi 120feb3
remove unused HTTPRouteMustHaveConditions
SinaChavoshi 8214cdf
update doc string for GetPod
SinaChavoshi 76cb644
update docstring
SinaChavoshi 5dca67b
Remove resource type from names in manifests.
SinaChavoshi f2c0602
remove type from name
SinaChavoshi daeb8e6
remove health check
SinaChavoshi f1ab79f
Merge remote-tracking branch 'upstream/main' into inf_pool_tests_11
SinaChavoshi 81562a2
add todo for combining getpod methods
SinaChavoshi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
conformance/tests/basic/inferencepool_multiple_rules_different_pools.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| /* | ||
| 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" | ||
|
|
||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| "k8s.io/apimachinery/pkg/types" | ||
| gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" | ||
| "sigs.k8s.io/gateway-api/conformance/utils/suite" | ||
|
|
||
| // Import the tests package to append to ConformanceTests | ||
| "sigs.k8s.io/gateway-api-inference-extension/conformance/tests" | ||
| "sigs.k8s.io/gateway-api-inference-extension/conformance/utils/config" | ||
| infrakubernetes "sigs.k8s.io/gateway-api-inference-extension/conformance/utils/kubernetes" | ||
| gatewaykubernetes "sigs.k8s.io/gateway-api/conformance/utils/kubernetes" | ||
| ) | ||
|
|
||
| func init() { | ||
| tests.ConformanceTests = append(tests.ConformanceTests, HTTPRouteMultipleRulesDifferentPools) | ||
| } | ||
|
|
||
| // HTTPRouteMultipleRulesDifferentPools defines the test case for validating | ||
| // that an HTTPRoute can successfully route to multiple distinct InferencePools | ||
| // based on different rules. | ||
SinaChavoshi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| var HTTPRouteMultipleRulesDifferentPools = suite.ConformanceTest{ | ||
| ShortName: "HTTPRouteMultipleRulesDifferentPools", | ||
| Description: "Validates that a single HTTPRoute can route to multiple different InferencePools based on distinct rules.", | ||
| Manifests: []string{"tests/basic/inferencepool_multiple_rules_different_pools.yaml"}, | ||
| Test: func(t *testing.T, s *suite.ConformanceTestSuite) { | ||
| const ( | ||
| appBackendNamespace = "gateway-conformance-app-backend" | ||
| infraNamespace = "gateway-conformance-infra" | ||
| httpRouteName = "httproute-multi-pool-rules" | ||
| poolAName = "pool-a" | ||
| poolBName = "pool-b" | ||
| gatewayName = "conformance-gateway" | ||
| ) | ||
|
|
||
| routeNN := types.NamespacedName{Name: httpRouteName, Namespace: appBackendNamespace} | ||
| poolANN := types.NamespacedName{Name: poolAName, Namespace: appBackendNamespace} | ||
| poolBNN := types.NamespacedName{Name: poolBName, Namespace: appBackendNamespace} | ||
| gatewayNN := types.NamespacedName{Name: gatewayName, Namespace: infraNamespace} | ||
|
|
||
| var timeoutConfig config.InferenceExtensionTimeoutConfig = config.DefaultInferenceExtensionTimeoutConfig() | ||
|
|
||
| t.Run("HTTPRoute should be Accepted and Reconciled", func(t *testing.T) { | ||
| acceptedCondition := metav1.Condition{ | ||
| Type: string(gatewayv1.RouteConditionAccepted), | ||
| Status: metav1.ConditionTrue, | ||
| Reason: string(gatewayv1.RouteReasonAccepted), | ||
| } | ||
| gatewaykubernetes.HTTPRouteMustHaveCondition(t, s.Client, timeoutConfig.TimeoutConfig, routeNN, gatewayNN, acceptedCondition) | ||
| t.Logf("HTTPRoute %s is Accepted by Gateway %s", routeNN.String(), gatewayNN.String()) | ||
|
|
||
| reconciledCondition := metav1.Condition{ | ||
| Type: string(gatewayv1.RouteConditionType("Reconciled")), | ||
| Status: metav1.ConditionTrue, | ||
| Reason: "ReconciliationSucceeded", | ||
| } | ||
| gatewaykubernetes.HTTPRouteMustHaveCondition(t, s.Client, timeoutConfig.TimeoutConfig, routeNN, gatewayNN, reconciledCondition) | ||
| t.Logf("HTTPRoute %s is Reconciled by Gateway %s", routeNN.String(), gatewayNN.String()) | ||
| }) | ||
|
|
||
| t.Run("InferencePool A should be Accepted", func(t *testing.T) { | ||
| acceptedCondition := metav1.Condition{ | ||
| Type: string(gatewayv1.RouteConditionAccepted), | ||
| Status: metav1.ConditionTrue, | ||
| Reason: string(gatewayv1.RouteReasonAccepted), | ||
| } | ||
| infrakubernetes.InferencePoolMustHaveCondition(t, s.Client, poolANN, acceptedCondition) | ||
| t.Logf("InferencePool %s parent status shows Accepted by Gateway %s (via HTTPRoute %s)", poolANN.String(), gatewayNN.String(), routeNN.String()) | ||
| }) | ||
|
|
||
| t.Run("InferencePool B should be Accepted", func(t *testing.T) { | ||
| acceptedCondition := metav1.Condition{ | ||
| Type: string(gatewayv1.RouteConditionAccepted), | ||
| Status: metav1.ConditionTrue, | ||
| Reason: string(gatewayv1.RouteReasonAccepted), | ||
| } | ||
| infrakubernetes.InferencePoolMustHaveCondition(t, s.Client, poolBNN, acceptedCondition) | ||
| t.Logf("InferencePool %s parent status shows Accepted by Gateway %s (via HTTPRoute %s)", poolBNN.String(), gatewayNN.String(), routeNN.String()) | ||
| }) | ||
| }, | ||
| } | ||
179 changes: 179 additions & 0 deletions
179
conformance/tests/basic/inferencepool_multiple_rules_different_pools.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,179 @@ | ||
| # httproute_multiple_rules_different_pools.yaml | ||
| # This manifest defines resources for the httproute_multiple_rules_different_pools conformance test. | ||
| # It includes two distinct backend deployments, two InferencePools selecting these deployments, | ||
| # and an HTTPRoute with multiple rules targeting these different InferencePools. | ||
SinaChavoshi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # --- Backend Deployment A --- | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: multi-pool-backend-a-deployment | ||
| namespace: gateway-conformance-app-backend | ||
| labels: | ||
| app: multi-pool-backend-a | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: multi-pool-backend-a | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: multi-pool-backend-a | ||
| spec: | ||
| containers: | ||
| - name: agnhost-echo-a | ||
| image: k8s.gcr.io/e2e-test-images/agnhost:2.39 | ||
| args: | ||
| - serve-hostname | ||
| - --port=8080 | ||
| ports: | ||
| - name: http | ||
| containerPort: 8080 | ||
| readinessProbe: | ||
| httpGet: | ||
| path: / | ||
| port: 8080 | ||
| initialDelaySeconds: 3 | ||
| periodSeconds: 5 | ||
| failureThreshold: 2 | ||
|
|
||
SinaChavoshi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --- | ||
| # --- Service for Backend Deployment A (EPP for pool-a) --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
SinaChavoshi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| metadata: | ||
| name: pool-a-epp | ||
| namespace: gateway-conformance-app-backend | ||
| spec: | ||
| selector: | ||
| app: multi-pool-backend-a | ||
| ports: | ||
| - name: http | ||
| protocol: TCP | ||
| port: 8080 | ||
| targetPort: 8080 | ||
| - name: epp | ||
| protocol: TCP | ||
| port: 9002 | ||
| targetPort: 9002 | ||
|
|
||
SinaChavoshi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --- | ||
| # --- Backend Deployment B --- | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: multi-pool-backend-b-deployment | ||
| namespace: gateway-conformance-app-backend | ||
| labels: | ||
| app: multi-pool-backend-b | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: multi-pool-backend-b | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: multi-pool-backend-b | ||
| spec: | ||
| containers: | ||
| - name: agnhost-echo-b | ||
| image: k8s.gcr.io/e2e-test-images/agnhost:2.39 | ||
| args: | ||
| - serve-hostname | ||
| - --port=8080 | ||
| ports: | ||
| - name: http | ||
| containerPort: 8080 | ||
| readinessProbe: | ||
| httpGet: | ||
| path: / | ||
| port: 8080 | ||
| initialDelaySeconds: 3 | ||
| periodSeconds: 5 | ||
| failureThreshold: 2 | ||
|
|
||
SinaChavoshi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --- | ||
| # --- Service for Backend Deployment B (EPP for pool-b) --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: pool-b-epp | ||
| namespace: gateway-conformance-app-backend | ||
| spec: | ||
| selector: | ||
| app: multi-pool-backend-b | ||
| ports: | ||
| - name: http | ||
| protocol: TCP | ||
| port: 8080 | ||
| targetPort: 8080 | ||
| - name: epp | ||
| protocol: TCP | ||
| port: 9002 | ||
| targetPort: 9002 | ||
SinaChavoshi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| --- | ||
| # --- InferencePool A Definition --- | ||
| apiVersion: inference.networking.x-k8s.io/v1alpha2 | ||
| kind: InferencePool | ||
| metadata: | ||
| name: pool-a | ||
| namespace: gateway-conformance-app-backend | ||
| spec: | ||
| selector: | ||
| app: "multi-pool-backend-a" | ||
| targetPortNumber: 8080 | ||
| extensionRef: | ||
| name: pool-a-epp | ||
|
|
||
SinaChavoshi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --- | ||
| # --- InferencePool B Definition --- | ||
| apiVersion: inference.networking.x-k8s.io/v1alpha2 | ||
| kind: InferencePool | ||
| metadata: | ||
| name: pool-b | ||
| namespace: gateway-conformance-app-backend | ||
| spec: | ||
| selector: | ||
| app: "multi-pool-backend-b" | ||
| targetPortNumber: 8080 | ||
| extensionRef: | ||
| name: pool-b-epp | ||
|
|
||
SinaChavoshi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --- | ||
| # --- HTTPRoute Definition for Multiple Pools --- | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: HTTPRoute | ||
| metadata: | ||
| name: httproute-multi-pool-rules | ||
| namespace: gateway-conformance-app-backend | ||
| spec: | ||
| parentRefs: | ||
| - group: gateway.networking.k8s.io | ||
| kind: Gateway | ||
| name: conformance-gateway | ||
| namespace: gateway-conformance-infra | ||
| sectionName: http | ||
SinaChavoshi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| rules: | ||
| - matches: | ||
| - path: | ||
| type: PathPrefix | ||
| value: /app-a | ||
| backendRefs: | ||
| - group: inference.networking.x-k8s.io | ||
| kind: InferencePool | ||
| name: pool-a | ||
| port: 8080 | ||
| weight: 1 | ||
SinaChavoshi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - matches: | ||
| - path: | ||
| type: PathPrefix | ||
| value: /app-b | ||
| backendRefs: | ||
| - group: inference.networking.x-k8s.io | ||
| kind: InferencePool | ||
| name: pool-b | ||
| port: 8080 | ||
| weight: 1 | ||
SinaChavoshi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
SinaChavoshi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.