Skip to content

Commit b6d5003

Browse files
authored
Merge branch 'kubernetes-sigs:main' into boilerplate_verification
2 parents 6369613 + 7c830cb commit b6d5003

File tree

15 files changed

+528
-154
lines changed

15 files changed

+528
-154
lines changed

conformance/resources/manifests/manifests.yaml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ metadata:
2323
gateway-conformance: backend
2424

2525
---
26-
# Namespace for simple web server backends. This is expected by
26+
# Namespace for simple web server backends. This is expected by
2727
# the upstream conformance suite's Setup method.
2828
apiVersion: v1
2929
kind: Namespace
@@ -50,8 +50,27 @@ spec:
5050
protocol: HTTP
5151
allowedRoutes:
5252
namespaces:
53-
from: All
53+
from: All
5454
kinds:
5555
# Allows HTTPRoutes to attach, which can then reference InferencePools.
5656
- group: gateway.networking.k8s.io
5757
kind: HTTPRoute
58+
59+
---
60+
# --- Conformance Secondary Gateway Definition ---
61+
# A second generic Gateway resource for tests requiring multiple Gateways.
62+
apiVersion: gateway.networking.k8s.io/v1
63+
kind: Gateway
64+
metadata:
65+
name: conformance-secondary-gateway
66+
namespace: gateway-conformance-infra
67+
spec:
68+
gatewayClassName: "{GATEWAY_CLASS_NAME}"
69+
listeners:
70+
- name: http
71+
port: 80
72+
protocol: HTTP
73+
hostname: "secondary.example.com" # Distinct hostname to differentiate from conformance-gateway
74+
allowedRoutes:
75+
namespaces:
76+
from: All

conformance/tests/basic/inferencepool_accepted.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ var InferencePoolAccepted = suite.ConformanceTest{
4141
ShortName: "InferencePoolAccepted",
4242
Description: "A minimal InferencePool resource should be accepted by the controller and report an Accepted condition",
4343
Manifests: []string{"tests/basic/inferencepool_accepted.yaml"},
44-
Features: []features.FeatureName{},
44+
Features: []features.FeatureName{
45+
features.FeatureName("SupportInferencePool"),
46+
features.SupportGateway,
47+
},
4548
Test: func(t *testing.T, s *suite.ConformanceTestSuite) {
4649
// created by the associated manifest file.
4750
poolNN := types.NamespacedName{Name: "inferencepool-basic-accepted", Namespace: "gateway-conformance-app-backend"}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package basic
18+
19+
import (
20+
"context"
21+
"testing"
22+
"time"
23+
24+
"github.com/stretchr/testify/require"
25+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26+
"k8s.io/apimachinery/pkg/types"
27+
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
28+
"sigs.k8s.io/gateway-api/conformance/utils/suite"
29+
"sigs.k8s.io/gateway-api/pkg/features"
30+
31+
"sigs.k8s.io/gateway-api-inference-extension/conformance/tests"
32+
k8sutils "sigs.k8s.io/gateway-api-inference-extension/conformance/utils/kubernetes"
33+
)
34+
35+
func init() {
36+
tests.ConformanceTests = append(tests.ConformanceTests, InferencePoolParentStatus)
37+
}
38+
39+
var InferencePoolParentStatus = suite.ConformanceTest{
40+
ShortName: "InferencePoolResolvedRefsCondition",
41+
Description: "Verify that an InferencePool correctly updates its parent-specific status (e.g., Accepted condition) when referenced by HTTPRoutes attached to shared Gateways, and clears parent statuses when no longer referenced.",
42+
Manifests: []string{"tests/basic/inferencepool_resolvedrefs_condition.yaml"},
43+
Features: []features.FeatureName{
44+
features.FeatureName("SupportInferencePool"),
45+
features.SupportGateway,
46+
},
47+
Test: func(t *testing.T, s *suite.ConformanceTestSuite) {
48+
const (
49+
appBackendNamespace = "gateway-conformance-app-backend"
50+
infraNamespace = "gateway-conformance-infra"
51+
poolName = "multi-gateway-pool"
52+
sharedGateway1Name = "conformance-gateway"
53+
sharedGateway2Name = "conformance-secondary-gateway"
54+
httpRoute1Name = "httproute-for-gw1"
55+
httpRoute2Name = "httproute-for-gw2"
56+
)
57+
58+
poolNN := types.NamespacedName{Name: poolName, Namespace: appBackendNamespace}
59+
httpRoute1NN := types.NamespacedName{Name: httpRoute1Name, Namespace: appBackendNamespace}
60+
httpRoute2NN := types.NamespacedName{Name: httpRoute2Name, Namespace: appBackendNamespace}
61+
gateway1NN := types.NamespacedName{Name: sharedGateway1Name, Namespace: infraNamespace}
62+
gateway2NN := types.NamespacedName{Name: sharedGateway2Name, Namespace: infraNamespace}
63+
64+
k8sutils.HTTPRouteMustBeAcceptedAndResolved(t, s.Client, s.TimeoutConfig, httpRoute1NN, gateway1NN)
65+
k8sutils.HTTPRouteMustBeAcceptedAndResolved(t, s.Client, s.TimeoutConfig, httpRoute2NN, gateway2NN)
66+
67+
t.Run("InferencePool should show Accepted:True by parents when referenced by multiple HTTPRoutes", func(t *testing.T) {
68+
k8sutils.InferencePoolMustBeAcceptedByParent(t, s.Client, poolNN)
69+
// TODO(#865) ensure requests are correctly routed to this InferencePool.
70+
t.Logf("InferencePool %s has parent status Accepted:True as expected with two references.", poolNN.String())
71+
})
72+
73+
t.Run("Delete httproute-for-gw1", func(t *testing.T) {
74+
httproute1 := &gatewayv1.HTTPRoute{
75+
ObjectMeta: metav1.ObjectMeta{Name: httpRoute1NN.Name, Namespace: httpRoute1NN.Namespace},
76+
}
77+
t.Logf("Deleting HTTPRoute %s", httpRoute1NN.String())
78+
require.NoError(t, s.Client.Delete(context.TODO(), httproute1), "failed to delete httproute-for-gw1")
79+
time.Sleep(s.TimeoutConfig.GatewayMustHaveCondition)
80+
})
81+
82+
t.Run("InferencePool should still show Accepted:True by parent after one HTTPRoute is deleted", func(t *testing.T) {
83+
k8sutils.InferencePoolMustBeAcceptedByParent(t, s.Client, poolNN)
84+
// TODO(#865) ensure requests are correctly routed to this InferencePool.
85+
t.Logf("InferencePool %s still has parent status Accepted:True as expected with one reference remaining.", poolNN.String())
86+
})
87+
88+
t.Run("Delete httproute-for-gw2", func(t *testing.T) {
89+
httproute2 := &gatewayv1.HTTPRoute{
90+
ObjectMeta: metav1.ObjectMeta{Name: httpRoute2NN.Name, Namespace: httpRoute2NN.Namespace},
91+
}
92+
t.Logf("Deleting HTTPRoute %s", httpRoute2NN.String())
93+
require.NoError(t, s.Client.Delete(context.TODO(), httproute2), "failed to delete httproute-for-gw2")
94+
})
95+
96+
t.Run("InferencePool should have no parent statuses after all HTTPRoutes are deleted", func(t *testing.T) {
97+
t.Logf("Waiting for InferencePool %s to have no parent statuses.", poolNN.String())
98+
k8sutils.InferencePoolMustHaveNoParents(t, s.Client, poolNN)
99+
t.Logf("InferencePool %s correctly shows no parent statuses, indicating it's no longer referenced.", poolNN.String())
100+
})
101+
102+
t.Logf("InferencePoolResolvedRefsCondition completed.")
103+
},
104+
}
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# conformance/tests/basic/inferencepool_resolvedrefs_condition.yaml
2+
3+
# This manifest defines the initial resources for the
4+
# inferencepool_resolvedrefs_condition.go conformance test.
5+
6+
# --- Backend Deployment (using agnhost echo server) ---
7+
# This Deployment provides Pods for the InferencePool to select.
8+
apiVersion: apps/v1
9+
kind: Deployment
10+
metadata:
11+
name: infra-backend-deployment
12+
namespace: gateway-conformance-app-backend
13+
labels:
14+
app: infra-backend
15+
spec:
16+
replicas: 1
17+
selector:
18+
matchLabels:
19+
app: infra-backend
20+
template:
21+
metadata:
22+
labels:
23+
app: infra-backend
24+
spec:
25+
containers:
26+
- name: agnhost-echo
27+
image: k8s.gcr.io/e2e-test-images/agnhost:2.39
28+
args:
29+
- serve-hostname
30+
- --port=8080
31+
ports:
32+
- name: http
33+
containerPort: 8080
34+
readinessProbe:
35+
httpGet:
36+
path: /
37+
port: 8080
38+
initialDelaySeconds: 3
39+
periodSeconds: 5
40+
failureThreshold: 2
41+
42+
---
43+
# --- Backend Service ---
44+
# Service for the infra-backend-deployment.
45+
apiVersion: v1
46+
kind: Service
47+
metadata:
48+
name: infra-backend-svc
49+
namespace: gateway-conformance-app-backend
50+
spec:
51+
selector:
52+
app: infra-backend
53+
ports:
54+
- name: http
55+
protocol: TCP
56+
port: 8080
57+
targetPort: 8080
58+
- name: epp
59+
port: 9002
60+
targetPort: 9002
61+
62+
---
63+
# --- InferencePool Definition ---
64+
apiVersion: inference.networking.x-k8s.io/v1alpha2
65+
kind: InferencePool
66+
metadata:
67+
name: multi-gateway-pool # Name used in the Go test
68+
namespace: gateway-conformance-app-backend # Defined in base manifests.yaml
69+
spec:
70+
# --- Selector (Required) ---
71+
# Selects the Pods belonging to this pool.
72+
selector:
73+
app: "infra-backend"
74+
# --- Target Port (Required) ---
75+
targetPortNumber: 8080
76+
extensionRef:
77+
name: infra-backend-svc
78+
79+
---
80+
# --- HTTPRoute for Gateway 1 (conformance-gateway) ---
81+
apiVersion: gateway.networking.k8s.io/v1
82+
kind: HTTPRoute
83+
metadata:
84+
name: httproute-for-gw1
85+
namespace: gateway-conformance-app-backend
86+
spec:
87+
parentRefs:
88+
- group: gateway.networking.k8s.io
89+
kind: Gateway
90+
name: conformance-gateway
91+
namespace: gateway-conformance-infra
92+
sectionName: http
93+
hostnames:
94+
- "gw1.example.com"
95+
rules:
96+
- backendRefs:
97+
- group: inference.networking.x-k8s.io
98+
kind: InferencePool
99+
name: multi-gateway-pool
100+
port: 8080
101+
matches:
102+
- path:
103+
type: PathPrefix
104+
value: /conformance-gateway-test
105+
106+
---
107+
# --- HTTPRoute for Gateway 2 (conformance-secondary-gateway) ---
108+
apiVersion: gateway.networking.k8s.io/v1
109+
kind: HTTPRoute
110+
metadata:
111+
name: httproute-for-gw2
112+
namespace: gateway-conformance-app-backend
113+
spec:
114+
parentRefs:
115+
- group: gateway.networking.k8s.io
116+
kind: Gateway
117+
name: conformance-secondary-gateway
118+
namespace: gateway-conformance-infra
119+
sectionName: http
120+
hostnames:
121+
- "secondary.example.com"
122+
rules:
123+
- backendRefs:
124+
- group: inference.networking.x-k8s.io
125+
kind: InferencePool
126+
name: multi-gateway-pool
127+
port: 8080
128+
matches:
129+
- path:
130+
type: PathPrefix
131+
value: /gateway-2-test

0 commit comments

Comments
 (0)