-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into backend-docs
- Loading branch information
Showing
15 changed files
with
197 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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
File renamed without changes.
This file contains 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,55 @@ | ||
// Copyright Envoy Gateway Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// The full text of the Apache license is available in the LICENSE file at | ||
// the root of the repo. | ||
|
||
package conformance | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/util/sets" | ||
"sigs.k8s.io/gateway-api/conformance/utils/suite" | ||
"sigs.k8s.io/gateway-api/pkg/features" | ||
) | ||
|
||
// SupportLevel represents the level of support for a feature. | ||
// See https://gateway-api.sigs.k8s.io/concepts/conformance/#2-support-levels. | ||
type SupportLevel string | ||
|
||
const ( | ||
// Core features are portable and expected to be supported by every implementation of Gateway-API. | ||
Core SupportLevel = "core" | ||
|
||
// Extended features are those that are portable but not universally supported across implementations. | ||
// Those implementations that support the feature will have the same behavior and semantics. | ||
// It is expected that some number of roadmap features will eventually migrate into the Core. | ||
Extended SupportLevel = "extended" | ||
) | ||
|
||
// ExtendedFeatures is a list of supported Gateway-API features that are considered Extended. | ||
var ExtendedFeatures = sets.New[features.SupportedFeature](). | ||
Insert(features.GatewayExtendedFeatures.UnsortedList()...). | ||
Insert(features.HTTPRouteExtendedFeatures.UnsortedList()...). | ||
Insert(features.MeshExtendedFeatures.UnsortedList()...) | ||
|
||
// GetTestSupportLevel returns the SupportLevel for a conformance test. | ||
// The support level is determined by the highest support level of the features. | ||
func GetTestSupportLevel(test suite.ConformanceTest) SupportLevel { | ||
supportLevel := Core | ||
|
||
if ExtendedFeatures.HasAny(test.Features...) { | ||
supportLevel = Extended | ||
} | ||
|
||
return supportLevel | ||
} | ||
|
||
// GetFeatureSupportLevel returns the SupportLevel for a feature. | ||
func GetFeatureSupportLevel(feature features.SupportedFeature) SupportLevel { | ||
supportLevel := Core | ||
|
||
if ExtendedFeatures.Has(feature) { | ||
supportLevel = Extended | ||
} | ||
|
||
return supportLevel | ||
} |
This file contains 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 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 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 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 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,22 @@ | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: rewrite-full-path | ||
namespace: gateway-conformance-infra | ||
spec: | ||
parentRefs: | ||
- name: same-namespace | ||
rules: | ||
- matches: | ||
- path: | ||
type: PathPrefix | ||
value: / | ||
filters: | ||
- type: URLRewrite | ||
urlRewrite: | ||
path: | ||
type: ReplaceFullPath | ||
replaceFullPath: /full-replace | ||
backendRefs: | ||
- name: infra-backend-v1 | ||
port: 8080 |
This file contains 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,59 @@ | ||
// Copyright Envoy Gateway Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// The full text of the Apache license is available in the LICENSE file at | ||
// the root of the repo. | ||
|
||
//go:build e2e | ||
// +build e2e | ||
|
||
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" | ||
) | ||
|
||
func init() { | ||
ConformanceTests = append(ConformanceTests, HTTPRouteRewriteFullPath) | ||
} | ||
|
||
var HTTPRouteRewriteFullPath = suite.ConformanceTest{ | ||
ShortName: "HTTPRouteRewriteFullPath", | ||
Description: "An HTTPRoute with path rewrite filter to replace full path", | ||
Manifests: []string{"testdata/httproute-rewrite-full-path.yaml"}, | ||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { | ||
ns := "gateway-conformance-infra" | ||
routeNN := types.NamespacedName{Name: "rewrite-full-path", 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: "/", | ||
}, | ||
ExpectedRequest: &http.ExpectedRequest{ | ||
Request: http.Request{ | ||
Path: "/full-replace", | ||
}, | ||
}, | ||
Backend: "infra-backend-v1", | ||
Namespace: ns, | ||
}, | ||
} | ||
for i := range testCases { | ||
// Declare tc here to avoid loop variable | ||
// reuse issues across parallel tests. | ||
tc := testCases[i] | ||
t.Run(tc.GetTestCaseName(i), func(t *testing.T) { | ||
t.Parallel() | ||
http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, tc) | ||
}) | ||
} | ||
}, | ||
} |