Skip to content

Commit 5349f54

Browse files
shaneuttk8s-ci-robot
authored andcommitted
feat: add HTTPRoute conformance test features
1 parent 50ddf7d commit 5349f54

File tree

1 file changed

+92
-26
lines changed

1 file changed

+92
-26
lines changed

conformance/utils/suite/features.go

Lines changed: 92 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2022 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+
117
package suite
218

319
import "k8s.io/apimachinery/pkg/util/sets"
@@ -11,31 +27,74 @@ import "k8s.io/apimachinery/pkg/util/sets"
1127
type SupportedFeature string
1228

1329
// -----------------------------------------------------------------------------
14-
// Features - All Profiles
30+
// Features - All Profiles (Core)
1531
// -----------------------------------------------------------------------------
1632

1733
const (
1834
// This option indicates support for ReferenceGrant (core conformance).
1935
// Opting out of this requires an implementation to have clearly implemented
2036
// and documented equivalent safeguards.
2137
SupportReferenceGrant SupportedFeature = "ReferenceGrant"
22-
23-
// This option indicates GatewayClass will update the observedGeneration in it's conditions when reconciling
24-
SupportGatewayClassObservedGenerationBump SupportedFeature = "GatewayClassObservedGenerationBump"
2538
)
2639

2740
// StandardCoreFeatures are the features that are required to be conformant with
28-
// the Core API features that are part of the Standard release channel.
41+
// the Core API features. All conformance profiles include this standard set.
42+
//
43+
// TODO: we need clarity for standard vs experimental features.
44+
// See: https://github.com/kubernetes-sigs/gateway-api/issues/1891
2945
var StandardCoreFeatures = sets.New(
3046
SupportReferenceGrant,
3147
)
3248

3349
// -----------------------------------------------------------------------------
34-
// Features - HTTP Conformance Profile
50+
// Features - All Profiles (Extended)
3551
// -----------------------------------------------------------------------------
3652

3753
const (
54+
// This option indicates GatewayClass will update the observedGeneration in
55+
// it's conditions when reconciling (extended conformance).
56+
//
57+
// NOTE: we intend to make this core and require implementations to do it
58+
// as we expect this is something every implementation should be able
59+
// to do and it's ideal behavior.
60+
//
61+
// See: https://github.com/kubernetes-sigs/gateway-api/issues/1780
62+
SupportGatewayClassObservedGenerationBump SupportedFeature = "GatewayClassObservedGenerationBump"
63+
64+
// This option indicates support for Destination Port matching.
65+
SupportRouteDestinationPortMatching SupportedFeature = "RouteDestinationPortMatching"
66+
)
3867

68+
// StandardExtendedFeatures are extra generic features that implementations may
69+
// choose to support as an opt-in.
70+
//
71+
// TODO: we need clarity for standard vs experimental features.
72+
// See: https://github.com/kubernetes-sigs/gateway-api/issues/1891
73+
var StandardExtendedFeatures = sets.New(
74+
SupportGatewayClassObservedGenerationBump,
75+
SupportRouteDestinationPortMatching,
76+
).Insert(StandardCoreFeatures.UnsortedList()...)
77+
78+
// -----------------------------------------------------------------------------
79+
// Features - HTTP Conformance Profile (Core)
80+
// -----------------------------------------------------------------------------
81+
82+
const (
83+
// This option indicates support for HTTPRoute
84+
SupportHTTPRoute SupportedFeature = "HTTPRoute"
85+
)
86+
87+
// HTTPCoreFeatures includes all SupportedFeatures needed to be conformant with
88+
// the HTTP conformance profile at a Core level of support.
89+
var HTTPCoreFeatures = sets.New(
90+
SupportHTTPRoute,
91+
)
92+
93+
// -----------------------------------------------------------------------------
94+
// Features - HTTP Conformance Profile (Extended)
95+
// -----------------------------------------------------------------------------
96+
97+
const (
3998
// This option indicates support for HTTPRoute query param matching (extended conformance).
4099
SupportHTTPRouteQueryParamMatching SupportedFeature = "HTTPRouteQueryParamMatching"
41100

@@ -45,9 +104,6 @@ const (
45104
// This option indicates support for HTTPRoute response header modification (extended conformance).
46105
SupportHTTPResponseHeaderModification SupportedFeature = "HTTPResponseHeaderModification"
47106

48-
// This option indicates support for Destination Port matching (extended conformance).
49-
SupportRouteDestinationPortMatching SupportedFeature = "RouteDestinationPortMatching"
50-
51107
// This option indicates support for HTTPRoute port redirect (extended conformance).
52108
SupportHTTPRoutePortRedirect SupportedFeature = "HTTPRoutePortRedirect"
53109

@@ -64,35 +120,45 @@ const (
64120
SupportHTTPRoutePathRewrite SupportedFeature = "HTTPRoutePathRewrite"
65121
)
66122

123+
// HTTPExtendedFeatures includes all the supported features for the HTTP conformance
124+
// profile and can be used to opt-in to run all HTTP tests (including extended
125+
// and experimental features).
126+
var HTTPExtendedFeatures = sets.New(
127+
SupportHTTPRouteQueryParamMatching,
128+
SupportHTTPRouteMethodMatching,
129+
SupportHTTPResponseHeaderModification,
130+
SupportHTTPRoutePortRedirect,
131+
SupportHTTPRouteSchemeRedirect,
132+
SupportHTTPRoutePathRedirect,
133+
SupportHTTPRouteHostRewrite,
134+
SupportHTTPRoutePathRewrite,
135+
).Insert(HTTPCoreFeatures.UnsortedList()...)
136+
67137
// -----------------------------------------------------------------------------
68138
// Features - TLS Conformance Profile
69139
// -----------------------------------------------------------------------------
70140

71141
const (
72-
// This option indicates support for TLSRoute (extended conformance).
142+
// This option indicates support for TLSRoute
73143
SupportTLSRoute SupportedFeature = "TLSRoute"
74144
)
75145

146+
// TLSCoreFeatures includes all the supported features for the TLS conformance
147+
// profile at a Core level of support.
148+
var TLSCoreFeatures = sets.New(
149+
SupportTLSRoute,
150+
)
151+
76152
// -----------------------------------------------------------------------------
77153
// Features - Compilations
78154
// -----------------------------------------------------------------------------
79155

80156
// AllFeatures contains all the supported features and can be used to run all
81157
// conformance tests with `all-features` flag.
82158
//
83-
// Note that the AllFeatures must in sync with defined features when the
84-
// feature constants change.
85-
var AllFeatures = sets.New(
86-
SupportReferenceGrant,
87-
SupportTLSRoute,
88-
SupportHTTPRouteQueryParamMatching,
89-
SupportHTTPRouteMethodMatching,
90-
SupportHTTPResponseHeaderModification,
91-
SupportRouteDestinationPortMatching,
92-
SupportGatewayClassObservedGenerationBump,
93-
SupportHTTPRoutePortRedirect,
94-
SupportHTTPRouteSchemeRedirect,
95-
SupportHTTPRoutePathRedirect,
96-
SupportHTTPRouteHostRewrite,
97-
SupportHTTPRoutePathRewrite,
98-
)
159+
// NOTE: as new profiles and levels are added, they should be inserted into
160+
// this set.
161+
var AllFeatures = sets.New[SupportedFeature]().
162+
Insert(StandardExtendedFeatures.UnsortedList()...).
163+
Insert(HTTPExtendedFeatures.UnsortedList()...).
164+
Insert(TLSCoreFeatures.UnsortedList()...)

0 commit comments

Comments
 (0)