Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ GCI = $(LOCALBIN)/gci

## Tool Versions
KUSTOMIZE_VERSION ?= v5.4.3
CONTROLLER_TOOLS_VERSION ?= v0.16.1
CONTROLLER_TOOLS_VERSION ?= v0.19.0
ENVTEST_VERSION ?= release-0.19
CRD_REF_DOCS_VERSION ?= v0.2.0
GOLANGCI_LINT_VERSION ?= v2.3.0
Expand Down
17 changes: 17 additions & 0 deletions client-go/applyconfiguration/api/v1/inferencepool.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions client-go/applyconfiguration/apix/v1alpha2/inferenceobjective.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions client-go/applyconfiguration/apix/v1alpha2/inferencepool.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client-go/applyconfiguration/internal/internal.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions client-go/applyconfiguration/utils.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions client-go/clientset/versioned/fake/clientset_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
annotations:
api-approved.kubernetes.io: https://github.com/kubernetes-sigs/gateway-api-inference-extension/pull/1173
inference.networking.k8s.io/bundle-version: v1.0.1
creationTimestamp: null
name: inferencepools.inference.networking.k8s.io
spec:
group: inference.networking.k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ kind: CustomResourceDefinition
metadata:
annotations:
inference.networking.k8s.io/bundle-version: v1.0.1
creationTimestamp: null
name: inferenceobjectives.inference.networking.x-k8s.io
spec:
group: inference.networking.x-k8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ metadata:
annotations:
api-approved.kubernetes.io: unapproved, experimental-only
inference.networking.k8s.io/bundle-version: v1.0.1
creationTimestamp: null
name: inferencepools.inference.networking.x-k8s.io
spec:
group: inference.networking.x-k8s.io
Expand Down
2 changes: 1 addition & 1 deletion conformance/tests/gateway_following_epp_routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func assertTrafficOnlyReachesToExpectedPods(t *testing.T, suite *suite.Conforman
if err != nil {
return fmt.Errorf("failed to roundtrip request: %w", err)
}
if err := gwhttp.CompareRequest(t, &req, cReq, cRes, expected); err != nil {
if err := gwhttp.CompareRoundTrip(t, &req, cReq, cRes, expected); err != nil {
return fmt.Errorf("response expectation failed for request: %w", err)
}

Expand Down
58 changes: 45 additions & 13 deletions conformance/utils/traffic/traffic.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,24 +169,56 @@ func waitForConvergeToExpected(
tlog.Logf(t, "Request passed")
}

// CompareRequestWithWildcardStatus compares requests with wildcard status code support.
// It treats a single-digit expected code (e.g., 4) as a class wildcard (4xx),
// while standard 3-digit codes are matched exactly.
func CompareRequestWithWildcardStatus(t *testing.T, req *roundtripper.Request, cReq *roundtripper.CapturedRequest, cRes *roundtripper.CapturedResponse, expected gwhttp.ExpectedResponse) error {
if expected.Response.StatusCode < 1 || expected.Response.StatusCode >= 100 {
return gwhttp.CompareRequest(t, req, cReq, cRes, expected)
// CompareRequestWithWildcardStatus compares requests allowing single-digit
// status "classes" (e.g. 5 => any 5xx) via ExpectedResponse.Response.StatusCodes.
// If no class wildcards are present, it defers to CompareRoundTrip.
func CompareRequestWithWildcardStatus(
t *testing.T,
req *roundtripper.Request,
cReq *roundtripper.CapturedRequest,
cRes *roundtripper.CapturedResponse,
expected gwhttp.ExpectedResponse,
) error {
// Separate specific status codes (>=100) from wildcard classes (1..9).
var wildcardClasses []int
var specificCodes []int
seenClass := map[int]struct{}{}
seenCode := map[int]struct{}{}

for _, sc := range expected.Response.StatusCodes {
switch {
case sc >= 100:
if _, ok := seenCode[sc]; !ok {
specificCodes = append(specificCodes, sc)
seenCode[sc] = struct{}{}
}
case sc >= 1 && sc <= 9:
if _, ok := seenClass[sc]; !ok {
wildcardClasses = append(wildcardClasses, sc)
seenClass[sc] = struct{}{}
}
}
}

expectedClass := expected.Response.StatusCode
// No wildcard classes? Defer to standard comparator.
if len(wildcardClasses) == 0 {
return gwhttp.CompareRoundTrip(t, req, cReq, cRes, expected)
}

// If the concrete status matches any wildcard class, materialize it and compare.
actualClass := cRes.StatusCode / 100
if expectedClass != actualClass {
return fmt.Errorf("expected status code class %dxx, but got %d", expectedClass, cRes.StatusCode)
for _, wc := range wildcardClasses {
if actualClass == wc {
modified := expected
// Keep any specific codes that were provided, but ensure the actual status is allowed.
modified.Response.StatusCodes = append(append([]int(nil), specificCodes...), cRes.StatusCode)
return gwhttp.CompareRoundTrip(t, req, cReq, cRes, modified)
}
}

// StatusCode Class matches; update status code on a copy to allow the standard comparator to pass.
modifiedExpected := expected
modifiedExpected.Response.StatusCode = cRes.StatusCode
return gwhttp.CompareRequest(t, req, cReq, cRes, modifiedExpected)
// Wildcards were provided but none matched the actual class—fail clearly.
return fmt.Errorf("expected status code class to be one of %vxx, got %d",
wildcardClasses, cRes.StatusCode)
}

// TODO: https://github.com/kubernetes-sigs/gateway-api-inference-extension/issues/1031
Expand Down
Loading