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
+
1
17
package suite
2
18
3
19
import "k8s.io/apimachinery/pkg/util/sets"
@@ -11,31 +27,74 @@ import "k8s.io/apimachinery/pkg/util/sets"
11
27
type SupportedFeature string
12
28
13
29
// -----------------------------------------------------------------------------
14
- // Features - All Profiles
30
+ // Features - All Profiles (Core)
15
31
// -----------------------------------------------------------------------------
16
32
17
33
const (
18
34
// This option indicates support for ReferenceGrant (core conformance).
19
35
// Opting out of this requires an implementation to have clearly implemented
20
36
// and documented equivalent safeguards.
21
37
SupportReferenceGrant SupportedFeature = "ReferenceGrant"
22
-
23
- // This option indicates GatewayClass will update the observedGeneration in it's conditions when reconciling
24
- SupportGatewayClassObservedGenerationBump SupportedFeature = "GatewayClassObservedGenerationBump"
25
38
)
26
39
27
40
// 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
29
45
var StandardCoreFeatures = sets .New (
30
46
SupportReferenceGrant ,
31
47
)
32
48
33
49
// -----------------------------------------------------------------------------
34
- // Features - HTTP Conformance Profile
50
+ // Features - All Profiles (Extended)
35
51
// -----------------------------------------------------------------------------
36
52
37
53
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
+ )
38
67
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 (
39
98
// This option indicates support for HTTPRoute query param matching (extended conformance).
40
99
SupportHTTPRouteQueryParamMatching SupportedFeature = "HTTPRouteQueryParamMatching"
41
100
@@ -45,9 +104,6 @@ const (
45
104
// This option indicates support for HTTPRoute response header modification (extended conformance).
46
105
SupportHTTPResponseHeaderModification SupportedFeature = "HTTPResponseHeaderModification"
47
106
48
- // This option indicates support for Destination Port matching (extended conformance).
49
- SupportRouteDestinationPortMatching SupportedFeature = "RouteDestinationPortMatching"
50
-
51
107
// This option indicates support for HTTPRoute port redirect (extended conformance).
52
108
SupportHTTPRoutePortRedirect SupportedFeature = "HTTPRoutePortRedirect"
53
109
@@ -64,35 +120,45 @@ const (
64
120
SupportHTTPRoutePathRewrite SupportedFeature = "HTTPRoutePathRewrite"
65
121
)
66
122
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
+
67
137
// -----------------------------------------------------------------------------
68
138
// Features - TLS Conformance Profile
69
139
// -----------------------------------------------------------------------------
70
140
71
141
const (
72
- // This option indicates support for TLSRoute (extended conformance).
142
+ // This option indicates support for TLSRoute
73
143
SupportTLSRoute SupportedFeature = "TLSRoute"
74
144
)
75
145
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
+
76
152
// -----------------------------------------------------------------------------
77
153
// Features - Compilations
78
154
// -----------------------------------------------------------------------------
79
155
80
156
// AllFeatures contains all the supported features and can be used to run all
81
157
// conformance tests with `all-features` flag.
82
158
//
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