generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 92
feat(conformance): Add HTTPRouteMultipleGatewaysDifferentPools test #838
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
Open
SinaChavoshi
wants to merge
31
commits into
kubernetes-sigs:main
Choose a base branch
from
SinaChavoshi:inf_pool_tests_12
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
c859896
copy from existing test to start with
SinaChavoshi fe540a7
update test and add gateway to main manifest
SinaChavoshi 63fedab
fix spelling error
SinaChavoshi 68812d7
check RouteConditionResolvedRefs instead of Reconciled
SinaChavoshi 5efaeb2
add new line at the end of yaml files.
SinaChavoshi 2cd8dab
delete blank lines in yaml files.
SinaChavoshi 26704a1
change variable names to use primary / secondary
SinaChavoshi bb62da7
add to do for name change across the project.
SinaChavoshi 796b584
fix comment
SinaChavoshi 403b588
Merge branch 'main' into inf_pool_tests_12
SinaChavoshi 6506d44
change all variable names to use primary/secondary consistantly
SinaChavoshi dafd21e
add to do for http route testing
SinaChavoshi ecf11e4
HTTPRouteMustBeAcceptedAndResolved
SinaChavoshi f1ce162
add helper method.
SinaChavoshi f3d8e8c
using helper method for pool route accepted.
SinaChavoshi 1cd8790
combline pool and route accpetnace
SinaChavoshi 44b1427
add http route validation
SinaChavoshi d15c25e
Merge branch 'main' into inf_pool_tests_12
SinaChavoshi 1451a90
remove extra comments and yaml fields.
SinaChavoshi adcc104
Merge branch 'main' into inf_pool_tests_12
SinaChavoshi 1535ccc
remove duplicate method
SinaChavoshi ff25051
fix timeout
SinaChavoshi cf587a6
remove modifiedTimeoutConfig.HTTPRouteMustHaveCondition per review co…
SinaChavoshi afc8bc3
remove excessive logging from conformance.go
SinaChavoshi 8588183
Update conformance/tests/basic/httproute_multiple_gateways_different_…
SinaChavoshi 8b6a873
Update conformance/tests/basic/httproute_multiple_gateways_different_…
SinaChavoshi efe3990
Update conformance/tests/basic/httproute_multiple_gateways_different_…
SinaChavoshi b63459d
Update conformance/tests/basic/httproute_multiple_gateways_different_…
SinaChavoshi b903d8f
Update conformance/tests/basic/httproute_multiple_gateways_different_…
SinaChavoshi 2d52812
Remove unecessary logs for accpeted reason.
SinaChavoshi 939ae57
Remove all comments from yaml and go files and fix yaml
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
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
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
119 changes: 119 additions & 0 deletions
119
conformance/tests/basic/httproute_multiple_gateways_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,119 @@ | ||
/* | ||
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 | ||
SinaChavoshi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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, HTTPRouteMultipleGatewaysDifferentPools) | ||
} | ||
|
||
var HTTPRouteMultipleGatewaysDifferentPools = suite.ConformanceTest{ | ||
ShortName: "HTTPRouteMultipleGatewaysDifferentPools", | ||
Description: "Validates two HTTPRoutes on different Gateways successfully referencing different InferencePools.", | ||
Manifests: []string{"tests/basic/httproute_multiple_gateways_different_pools.yaml"}, | ||
Test: func(t *testing.T, s *suite.ConformanceTestSuite) { | ||
const ( | ||
appBackendNamespace = "gateway-conformance-app-backend" | ||
infraNamespace = "gateway-conformance-infra" | ||
gateway1Name = "conformance-gateway" | ||
gateway2Name = "conformance-secondary-gateway" | ||
routeForGW1Name = "route-for-gw1" | ||
routeForGW2Name = "route-for-gw2" | ||
SinaChavoshi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
poolAName = "pool-a" | ||
poolBName = "pool-b" | ||
) | ||
|
||
routeForGW1NN := types.NamespacedName{Name: routeForGW1Name, Namespace: appBackendNamespace} | ||
routeForGW2NN := types.NamespacedName{Name: routeForGW2Name, Namespace: appBackendNamespace} | ||
poolANN := types.NamespacedName{Name: poolAName, Namespace: appBackendNamespace} | ||
poolBNN := types.NamespacedName{Name: poolBName, Namespace: appBackendNamespace} | ||
gateway1NN := types.NamespacedName{Name: gateway1Name, Namespace: infraNamespace} | ||
gateway2NN := types.NamespacedName{Name: gateway2Name, Namespace: infraNamespace} | ||
|
||
var timeoutConfig config.InferenceExtensionTimeoutConfig = config.DefaultInferenceExtensionTimeoutConfig() | ||
|
||
t.Run("HTTPRoute for Gateway 1 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, routeForGW1NN, gateway1NN, acceptedCondition) | ||
t.Logf("HTTPRoute %s is Accepted by Gateway %s", routeForGW1NN.String(), gateway1NN.String()) | ||
|
||
reconciledCondition := metav1.Condition{ | ||
Type: string(gatewayv1.RouteConditionType("Reconciled")), | ||
Status: metav1.ConditionTrue, | ||
Reason: "ReconciliationSucceeded", | ||
} | ||
gatewaykubernetes.HTTPRouteMustHaveCondition(t, s.Client, timeoutConfig.TimeoutConfig, routeForGW1NN, gateway1NN, reconciledCondition) | ||
t.Logf("HTTPRoute %s is Reconciled by Gateway %s", routeForGW1NN.String(), gateway1NN.String()) | ||
}) | ||
|
||
t.Run("InferencePool A (pool-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(), gateway1NN.String(), routeForGW1NN.String()) | ||
}) | ||
|
||
t.Run("HTTPRoute for Gateway 2 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, routeForGW2NN, gateway2NN, acceptedCondition) | ||
t.Logf("HTTPRoute %s is Accepted by Gateway %s", routeForGW2NN.String(), gateway2NN.String()) | ||
|
||
reconciledCondition := metav1.Condition{ | ||
Type: string(gatewayv1.RouteConditionType("Reconciled")), | ||
Status: metav1.ConditionTrue, | ||
Reason: "ReconciliationSucceeded", | ||
} | ||
gatewaykubernetes.HTTPRouteMustHaveCondition(t, s.Client, timeoutConfig.TimeoutConfig, routeForGW2NN, gateway2NN, reconciledCondition) | ||
t.Logf("HTTPRoute %s is Reconciled by Gateway %s", routeForGW2NN.String(), gateway2NN.String()) | ||
}) | ||
|
||
t.Run("InferencePool B (pool-b) should be Accepted", func(t *testing.T) { | ||
SinaChavoshi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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(), gateway2NN.String(), routeForGW2NN.String()) | ||
}) | ||
}, | ||
} |
199 changes: 199 additions & 0 deletions
199
conformance/tests/basic/httproute_multiple_gateways_different_pools.yaml
SinaChavoshi marked this conversation as resolved.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
# httproute_multiple_gateways_different_pools.yaml | ||
# This manifest defines resources for the httproute_multiple_gateways_different_pools conformance test. | ||
# It includes two distinct backend deployments, their EPP services, two InferencePools, | ||
# and two HTTPRoutes, each linking to one of the two shared Gateways from the base manifests. | ||
|
||
# --- Backend Deployment A --- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: multi-gw-backend-a-deployment | ||
namespace: gateway-conformance-app-backend | ||
labels: | ||
app: multi-gw-backend-a | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: multi-gw-backend-a | ||
template: | ||
metadata: | ||
labels: | ||
app: multi-gw-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.
Show resolved
Hide resolved
|
||
--- | ||
# --- Service for Backend Deployment A (EPP for pool-a) --- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: pool-a-epp | ||
namespace: gateway-conformance-app-backend | ||
spec: | ||
selector: | ||
app: multi-gw-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.
Show resolved
Hide resolved
|
||
|
||
--- | ||
# --- Backend Deployment B --- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: multi-gw-backend-b-deployment | ||
namespace: gateway-conformance-app-backend | ||
labels: | ||
app: multi-gw-backend-b | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: multi-gw-backend-b | ||
template: | ||
metadata: | ||
labels: | ||
app: multi-gw-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 | ||
|
||
--- | ||
# --- 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-gw-backend-b | ||
ports: | ||
- name: http | ||
protocol: TCP | ||
port: 8080 | ||
targetPort: 8080 | ||
- name: epp | ||
protocol: TCP | ||
port: 9002 | ||
targetPort: 9002 | ||
|
||
--- | ||
# --- 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-gw-backend-a" | ||
targetPortNumber: 8080 | ||
extensionRef: | ||
name: pool-a-epp | ||
|
||
--- | ||
# --- 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-gw-backend-b" | ||
targetPortNumber: 8080 | ||
extensionRef: | ||
name: pool-b-epp | ||
|
||
--- | ||
# --- HTTPRoute for Gateway 1 (conformance-gateway) --- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: route-for-gw1 | ||
namespace: gateway-conformance-app-backend | ||
spec: | ||
parentRefs: | ||
- group: gateway.networking.k8s.io | ||
kind: Gateway | ||
name: conformance-gateway # Referencing shared conformance-gateway | ||
namespace: gateway-conformance-infra # Gateway is in infra namespace | ||
sectionName: http | ||
hostnames: | ||
- "gw1.example.com" # Specific hostname for this route | ||
rules: | ||
- backendRefs: | ||
- group: inference.networking.x-k8s.io | ||
kind: InferencePool | ||
name: pool-a | ||
port: 8080 | ||
weight: 1 | ||
matches: | ||
- path: | ||
type: PathPrefix | ||
value: /test-gw1 | ||
|
||
--- | ||
# --- HTTPRoute for Gateway 2 (conformance-secondary-gateway) --- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: route-for-gw2 | ||
namespace: gateway-conformance-app-backend | ||
spec: | ||
parentRefs: | ||
- group: gateway.networking.k8s.io | ||
kind: Gateway | ||
name: conformance-secondary-gateway # Referencing shared conformance-secondary-gateway | ||
namespace: gateway-conformance-infra # Gateway is in infra namespace | ||
sectionName: http | ||
hostnames: | ||
- "secondary.example.com" # Matching hostname of conformance-secondary-gateway | ||
rules: | ||
- backendRefs: | ||
- group: inference.networking.x-k8s.io | ||
kind: InferencePool | ||
name: pool-b | ||
port: 8080 | ||
weight: 1 | ||
matches: | ||
- path: | ||
type: PathPrefix | ||
value: /test-gw2 | ||
SinaChavoshi marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
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.