Skip to content

Move HTTPRouteRule and GRPCRouteRule 'name' fields to Standard #3826

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
merged 9 commits into from
Jul 3, 2025
1 change: 0 additions & 1 deletion apis/v1/grpcroute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ type GRPCRouteRule struct {
//
// Support: Extended
// +optional
// <gateway:experimental>
Name *SectionName `json:"name,omitempty"`

// Matches define conditions used for matching the rule against incoming
Expand Down
1 change: 0 additions & 1 deletion apis/v1/httproute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ type HTTPRouteRule struct {
//
// Support: Extended
// +optional
// <gateway:experimental>
Name *SectionName `json:"name,omitempty"`

// Matches define conditions used for matching the rule against incoming
Expand Down
9 changes: 9 additions & 0 deletions config/crd/standard/gateway.networking.k8s.io_grpcroutes.yaml

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

18 changes: 18 additions & 0 deletions config/crd/standard/gateway.networking.k8s.io_httproutes.yaml

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

72 changes: 72 additions & 0 deletions conformance/tests/grpcroute-named-rule.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
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 tests

import (
"testing"

"k8s.io/apimachinery/pkg/types"

v1 "sigs.k8s.io/gateway-api/apis/v1"
pb "sigs.k8s.io/gateway-api/conformance/echo-basic/grpcechoserver"
"sigs.k8s.io/gateway-api/conformance/utils/grpc"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
"sigs.k8s.io/gateway-api/pkg/features"
)

func init() {
ConformanceTests = append(ConformanceTests, GRPCRouteNamedRule)
}

var GRPCRouteNamedRule = suite.ConformanceTest{
ShortName: "GRPCRouteNamedRule",
Description: "An GRPCRoute with a named GRPCRouteRule",
Manifests: []string{"tests/grpcroute-named-rule.yaml"},
Features: []features.FeatureName{
features.SupportGateway,
features.SupportGRPCRoute,
features.SupportGRPCRouteNamedRouteRule,
},
Provisional: true,
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
ns := "gateway-conformance-infra"
routeNN := types.NamespacedName{Name: "grpc-named-rules", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), &v1.GRPCRoute{}, routeNN)

testCases := []grpc.ExpectedResponse{
{
EchoRequest: &pb.EchoRequest{},
Backend: "grpc-infra-backend-v1",
Namespace: ns,
}, {
EchoTwoRequest: &pb.EchoRequest{},
Backend: "grpc-infra-backend-v2",
Namespace: ns,
},
}

for i := range testCases {
tc := testCases[i]
t.Run(tc.GetTestCaseName(i), func(t *testing.T) {
t.Parallel()
grpc.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.GRPCClient, suite.TimeoutConfig, gwAddr, tc)
})
}
},
}
24 changes: 24 additions & 0 deletions conformance/tests/grpcroute-named-rule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: gateway.networking.k8s.io/v1
kind: GRPCRoute
metadata:
name: grpc-named-rules
namespace: gateway-conformance-infra
spec:
parentRefs:
- name: same-namespace
rules:
- name: named-rule
matches:
- method:
service: gateway_api_conformance.echo_basic.grpcecho.GrpcEcho
method: Echo
backendRefs:
- name: grpc-infra-backend-v1
port: 8080
- matches:
- method:
service: gateway_api_conformance.echo_basic.grpcecho.GrpcEcho
method: EchoTwo
backendRefs:
- name: grpc-infra-backend-v2
port: 8080
71 changes: 71 additions & 0 deletions conformance/tests/httproute-named-rule.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
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 tests

import (
"testing"

"k8s.io/apimachinery/pkg/types"

"sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
"sigs.k8s.io/gateway-api/pkg/features"
)

func init() {
ConformanceTests = append(ConformanceTests, HTTPRouteNamedRule)
}

var HTTPRouteNamedRule = suite.ConformanceTest{
ShortName: "HTTPRouteNamedRule",
Description: "An HTTPRoute with a named HTTPRouteRule",
Manifests: []string{"tests/httproute-named-rule.yaml"},
Features: []features.FeatureName{
features.SupportGateway,
features.SupportHTTPRoute,
features.SupportHTTPRouteNamedRouteRule,
},
Provisional: true,
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
ns := "gateway-conformance-infra"
routeNN := types.NamespacedName{Name: "http-named-rules", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
kubernetes.HTTPRouteMustHaveResolvedRefsConditionsTrue(t, suite.Client, suite.TimeoutConfig, routeNN, gwNN)

testCases := []http.ExpectedResponse{
{
Request: http.Request{Path: "/named"},
Response: http.Response{StatusCode: 200},
Namespace: ns,
}, {
Request: http.Request{Path: "/unnamed"},
Response: http.Response{StatusCode: 200},
Namespace: ns,
},
}

for i := range testCases {
tc := testCases[i]
t.Run(tc.GetTestCaseName(i), func(t *testing.T) {
t.Parallel()
http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, tc)
})
}
},
}
24 changes: 24 additions & 0 deletions conformance/tests/httproute-named-rule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: http-named-rules
namespace: gateway-conformance-infra
spec:
parentRefs:
- name: same-namespace
rules:
- name: named-rule
matches:
- path:
type: PathPrefix
value: /named
backendRefs:
- name: infra-backend-v1
port: 8080
- matches:
- path:
type: PathPrefix
value: /unnamed
backendRefs:
- name: infra-backend-v2
port: 8080
68 changes: 68 additions & 0 deletions conformance/tests/mesh/httproute-named-rule.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
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 meshtests

import (
"testing"

"sigs.k8s.io/gateway-api/conformance/utils/echo"
"sigs.k8s.io/gateway-api/conformance/utils/http"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
"sigs.k8s.io/gateway-api/pkg/features"
)

func init() {
MeshConformanceTests = append(MeshConformanceTests, MeshHTTPRouteNamedRule)
}

var MeshHTTPRouteNamedRule = suite.ConformanceTest{
ShortName: "MeshHTTPRouteNamedRule",
Description: "An HTTPRoute with a named HTTPRouteRule",
Manifests: []string{"tests/mesh/httproute-named-rule.yaml"},
Features: []features.FeatureName{
features.SupportMesh,
features.SupportHTTPRoute,
features.SupportMeshHTTPRouteNamedRouteRule,
},
Provisional: true,
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
ns := "gateway-conformance-mesh"
client := echo.ConnectToApp(t, suite, echo.MeshAppEchoV1)

testCases := []http.ExpectedResponse{
{
Request: http.Request{Path: "/named"},
ExpectedRequest: &http.ExpectedRequest{Request: http.Request{Path: "/named"}},
Backend: "echo-v1",
Namespace: ns,
}, {
Request: http.Request{Path: "/unnamed"},
ExpectedRequest: &http.ExpectedRequest{Request: http.Request{Path: "/named"}},
Backend: "echo-v2",
Namespace: ns,
},
}

for i := range testCases {
tc := testCases[i]
t.Run(tc.GetTestCaseName(i), func(t *testing.T) {
t.Parallel()
client.MakeRequestAndExpectEventuallyConsistentResponse(t, tc, suite.TimeoutConfig)
})
}
},
}
27 changes: 27 additions & 0 deletions conformance/tests/mesh/httproute-named-rule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: mesh-http-named-rules
namespace: gateway-conformance-mesh
spec:
parentRefs:
- group: ""
kind: Service
name: echo
port: 80
rules:
- name: named-rule
matches:
- path:
type: PathPrefix
value: /named
backendRefs:
- name: echo-v1
port: 8080
- matches:
- path:
type: PathPrefix
value: /unnamed
backendRefs:
- name: echo-v2
port: 8080
2 changes: 1 addition & 1 deletion geps/gep-995/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# GEP-995: Named route rules

* Issue: [#995](https://github.com/kubernetes-sigs/gateway-api/issues/995)
* Status: Experimental
* Status: Standard

## TLDR

Expand Down
2 changes: 1 addition & 1 deletion geps/gep-995/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: internal.gateway.networking.k8s.io/v1alpha1
kind: GEPDetails
number: 995
name: Named route rules
status: Experimental
status: Standard
authors:
- guicassolato
changelog:
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ nav:
- geps/gep-91/index.md
- geps/gep-3567/index.md
- Experimental:
- geps/gep-995/index.md
- geps/gep-1619/index.md
- geps/gep-1713/index.md
- geps/gep-1731/index.md
Expand All @@ -155,6 +154,7 @@ nav:
- geps/gep-820/index.md
- geps/gep-851/index.md
- geps/gep-957/index.md
- geps/gep-995/index.md
- geps/gep-1016/index.md
- geps/gep-1294/index.md
- geps/gep-1323/index.md
Expand Down
Loading