1
0
Fork 0

Update sigs.k8s.io/gateway-api to v1.2.0-rc1

Co-authored-by: Kevin Pollet <pollet.kevin@gmail.com>
This commit is contained in:
Romain 2024-09-26 09:12:04 +02:00 committed by GitHub
parent 312ebb17ab
commit a6db1cac37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 1280 additions and 2203 deletions

View file

@ -2,22 +2,22 @@ package gateway
import "sigs.k8s.io/gateway-api/pkg/features"
func SupportedFeatures() []features.SupportedFeature {
return []features.SupportedFeature{
features.SupportGateway,
features.SupportGatewayPort8080,
features.SupportGRPCRoute,
features.SupportHTTPRoute,
features.SupportHTTPRouteQueryParamMatching,
features.SupportHTTPRouteMethodMatching,
features.SupportHTTPRoutePortRedirect,
features.SupportHTTPRouteSchemeRedirect,
features.SupportHTTPRouteHostRewrite,
features.SupportHTTPRoutePathRewrite,
features.SupportHTTPRoutePathRedirect,
features.SupportHTTPRouteResponseHeaderModification,
features.SupportTLSRoute,
features.SupportHTTPRouteBackendProtocolH2C,
features.SupportHTTPRouteBackendProtocolWebSocket,
func SupportedFeatures() []features.FeatureName {
return []features.FeatureName{
features.GatewayFeature.Name,
features.GatewayPort8080Feature.Name,
features.GRPCRouteFeature.Name,
features.HTTPRouteFeature.Name,
features.HTTPRouteQueryParamMatchingFeature.Name,
features.HTTPRouteMethodMatchingFeature.Name,
features.HTTPRoutePortRedirectFeature.Name,
features.HTTPRouteSchemeRedirectFeature.Name,
features.HTTPRouteHostRewriteFeature.Name,
features.HTTPRoutePathRewriteFeature.Name,
features.HTTPRoutePathRedirectFeature.Name,
features.HTTPRouteResponseHeaderModificationFeature.Name,
features.HTTPRouteBackendProtocolH2CFeature.Name,
features.HTTPRouteBackendProtocolWebSocketFeature.Name,
features.TLSRouteFeature.Name,
}
}

View file

@ -396,10 +396,10 @@ func buildGRPCMethodRule(method *gatev1.GRPCMethodMatch) string {
func buildGRPCHeaderRules(headers []gatev1.GRPCHeaderMatch) []string {
var rules []string
for _, header := range headers {
switch ptr.Deref(header.Type, gatev1.HeaderMatchExact) {
case gatev1.HeaderMatchExact:
switch ptr.Deref(header.Type, gatev1.GRPCHeaderMatchExact) {
case gatev1.GRPCHeaderMatchExact:
rules = append(rules, fmt.Sprintf("Header(`%s`,`%s`)", header.Name, header.Value))
case gatev1.HeaderMatchRegularExpression:
case gatev1.GRPCHeaderMatchRegularExpression:
rules = append(rules, fmt.Sprintf("HeaderRegexp(`%s`,`%s`)", header.Name, header.Value))
}
}

View file

@ -50,7 +50,7 @@ func Test_buildGRPCMatchRule(t *testing.T) {
},
Headers: []gatev1.GRPCHeaderMatch{
{
Type: ptr.To(gatev1.HeaderMatchExact),
Type: ptr.To(gatev1.GRPCHeaderMatchExact),
Name: "foo",
Value: "bar",
},
@ -70,7 +70,7 @@ func Test_buildGRPCMatchRule(t *testing.T) {
},
Headers: []gatev1.GRPCHeaderMatch{
{
Type: ptr.To(gatev1.HeaderMatchExact),
Type: ptr.To(gatev1.GRPCHeaderMatchExact),
Name: "foo",
Value: "bar",
},
@ -177,7 +177,7 @@ func Test_buildGRPCHeaderRules(t *testing.T) {
desc: "One exact match type",
headers: []gatev1.GRPCHeaderMatch{
{
Type: ptr.To(gatev1.HeaderMatchExact),
Type: ptr.To(gatev1.GRPCHeaderMatchExact),
Name: "foo",
Value: "bar",
},
@ -188,7 +188,7 @@ func Test_buildGRPCHeaderRules(t *testing.T) {
desc: "One regexp match type",
headers: []gatev1.GRPCHeaderMatch{
{
Type: ptr.To(gatev1.HeaderMatchRegularExpression),
Type: ptr.To(gatev1.GRPCHeaderMatchRegularExpression),
Name: "foo",
Value: ".*",
},
@ -199,12 +199,12 @@ func Test_buildGRPCHeaderRules(t *testing.T) {
desc: "One exact and regexp match type",
headers: []gatev1.GRPCHeaderMatch{
{
Type: ptr.To(gatev1.HeaderMatchExact),
Type: ptr.To(gatev1.GRPCHeaderMatchExact),
Name: "foo",
Value: "bar",
},
{
Type: ptr.To(gatev1.HeaderMatchRegularExpression),
Type: ptr.To(gatev1.GRPCHeaderMatchRegularExpression),
Name: "foo",
Value: ".*",
},

View file

@ -317,10 +317,14 @@ func (p *Provider) loadConfigurationFromGateways(ctx context.Context) *dynamic.C
}
var supportedFeatures []gatev1.SupportedFeature
for _, feature := range SupportedFeatures() {
supportedFeatures = append(supportedFeatures, gatev1.SupportedFeature(feature))
if p.ExperimentalChannel {
for _, feature := range SupportedFeatures() {
supportedFeatures = append(supportedFeatures, gatev1.SupportedFeature{Name: gatev1.FeatureName(feature)})
}
slices.SortFunc(supportedFeatures, func(a, b gatev1.SupportedFeature) int {
return strings.Compare(string(a.Name), string(b.Name))
})
}
slices.Sort(supportedFeatures)
gatewayClassNames := map[string]struct{}{}
for _, gatewayClass := range gatewayClasses {