sigs.k8s.io/gateway-api@v1.0.0/conformance/utils/suite/features.go (about)

     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  
    17  package suite
    18  
    19  import "k8s.io/apimachinery/pkg/util/sets"
    20  
    21  // -----------------------------------------------------------------------------
    22  // Features - Types
    23  // -----------------------------------------------------------------------------
    24  
    25  // SupportedFeature allows opting in to additional conformance tests at an
    26  // individual feature granularity.
    27  type SupportedFeature string
    28  
    29  // -----------------------------------------------------------------------------
    30  // Features - Gateway Conformance (Core)
    31  // -----------------------------------------------------------------------------
    32  
    33  const (
    34  	// This option indicates support for Gateway.
    35  	// Opting out of this is allowed only for GAMMA-only implementations
    36  	SupportGateway SupportedFeature = "Gateway"
    37  )
    38  
    39  // GatewayCoreFeatures are the features that are required to be conformant with
    40  // the Gateway resource.
    41  var GatewayCoreFeatures = sets.New(
    42  	SupportGateway,
    43  )
    44  
    45  // -----------------------------------------------------------------------------
    46  // Features - Gateway Conformance (Extended)
    47  // -----------------------------------------------------------------------------
    48  
    49  const (
    50  	// This option indicates that the Gateway can also use port 8080
    51  	SupportGatewayPort8080 SupportedFeature = "GatewayPort8080"
    52  
    53  	// SupportGatewayStaticAddresses option indicates that the Gateway is capable
    54  	// of allocating pre-determined addresses, rather than dynamically having
    55  	// addresses allocated for it.
    56  	SupportGatewayStaticAddresses SupportedFeature = "GatewayStaticAddresses"
    57  )
    58  
    59  // StandardExtendedFeatures are extra generic features that implementations may
    60  // choose to support as an opt-in.
    61  var GatewayExtendedFeatures = sets.New(
    62  	SupportGatewayPort8080,
    63  	SupportGatewayStaticAddresses,
    64  ).Insert(GatewayCoreFeatures.UnsortedList()...)
    65  
    66  // -----------------------------------------------------------------------------
    67  // Features - ReferenceGrant Conformance (Core)
    68  // -----------------------------------------------------------------------------
    69  
    70  const (
    71  	// This option indicates support for ReferenceGrant.
    72  	SupportReferenceGrant SupportedFeature = "ReferenceGrant"
    73  )
    74  
    75  // ReferenceGrantCoreFeatures includes all SupportedFeatures needed to be
    76  // conformant with the ReferenceGrant resource.
    77  var ReferenceGrantCoreFeatures = sets.New(
    78  	SupportReferenceGrant,
    79  )
    80  
    81  // -----------------------------------------------------------------------------
    82  // Features - HTTPRoute Conformance (Core)
    83  // -----------------------------------------------------------------------------
    84  
    85  const (
    86  	// This option indicates support for HTTPRoute
    87  	SupportHTTPRoute SupportedFeature = "HTTPRoute"
    88  )
    89  
    90  // HTTPRouteCoreFeatures includes all SupportedFeatures needed to be conformant with
    91  // the HTTPRoute resource.
    92  var HTTPRouteCoreFeatures = sets.New(
    93  	SupportHTTPRoute,
    94  )
    95  
    96  // -----------------------------------------------------------------------------
    97  // Features - HTTPRoute Conformance (Extended)
    98  // -----------------------------------------------------------------------------
    99  
   100  const (
   101  	// This option indicates support for HTTPRoute query param matching (extended conformance).
   102  	SupportHTTPRouteQueryParamMatching SupportedFeature = "HTTPRouteQueryParamMatching"
   103  
   104  	// This option indicates support for HTTPRoute method matching (extended conformance).
   105  	SupportHTTPRouteMethodMatching SupportedFeature = "HTTPRouteMethodMatching"
   106  
   107  	// This option indicates support for HTTPRoute response header modification (extended conformance).
   108  	SupportHTTPRouteResponseHeaderModification SupportedFeature = "HTTPRouteResponseHeaderModification"
   109  
   110  	// This option indicates support for HTTPRoute port redirect (extended conformance).
   111  	SupportHTTPRoutePortRedirect SupportedFeature = "HTTPRoutePortRedirect"
   112  
   113  	// This option indicates support for HTTPRoute scheme redirect (extended conformance).
   114  	SupportHTTPRouteSchemeRedirect SupportedFeature = "HTTPRouteSchemeRedirect"
   115  
   116  	// This option indicates support for HTTPRoute path redirect (extended conformance).
   117  	SupportHTTPRoutePathRedirect SupportedFeature = "HTTPRoutePathRedirect"
   118  
   119  	// This option indicates support for HTTPRoute host rewrite (extended conformance)
   120  	SupportHTTPRouteHostRewrite SupportedFeature = "HTTPRouteHostRewrite"
   121  
   122  	// This option indicates support for HTTPRoute path rewrite (extended conformance)
   123  	SupportHTTPRoutePathRewrite SupportedFeature = "HTTPRoutePathRewrite"
   124  
   125  	// This option indicates support for HTTPRoute request mirror (extended conformance).
   126  	SupportHTTPRouteRequestMirror SupportedFeature = "HTTPRouteRequestMirror"
   127  
   128  	// This option indicates support for multiple RequestMirror filters within the same HTTPRoute rule (extended conformance).
   129  	SupportHTTPRouteRequestMultipleMirrors SupportedFeature = "HTTPRouteRequestMultipleMirrors"
   130  
   131  	// This option indicates support for HTTPRoute request timeouts (extended conformance).
   132  	SupportHTTPRouteRequestTimeout SupportedFeature = "HTTPRouteRequestTimeout"
   133  
   134  	// This option indicates support for HTTPRoute backendRequest timeouts (extended conformance).
   135  	SupportHTTPRouteBackendTimeout SupportedFeature = "HTTPRouteBackendTimeout"
   136  
   137  	// This option indicates support for HTTPRoute with a backendref with an appProtocol 'kubernetes.io/h2c'
   138  	SupportHTTPRouteBackendProtocolH2C SupportedFeature = "HTTPRouteBackendProtocolH2C"
   139  
   140  	// This option indicates support for HTTPRoute with a backendref with an appProtoocol 'kubernetes.io/ws'
   141  	SupportHTTPRouteBackendProtocolWebSocket SupportedFeature = "HTTPRouteBackendProtocolWebSocket"
   142  )
   143  
   144  // HTTPRouteExtendedFeatures includes all the supported features for HTTPRoute
   145  // conformance and can be used to opt-in to run all HTTPRoute tests, including
   146  // extended features.
   147  var HTTPRouteExtendedFeatures = sets.New(
   148  	SupportHTTPRouteQueryParamMatching,
   149  	SupportHTTPRouteMethodMatching,
   150  	SupportHTTPRouteResponseHeaderModification,
   151  	SupportHTTPRoutePortRedirect,
   152  	SupportHTTPRouteSchemeRedirect,
   153  	SupportHTTPRoutePathRedirect,
   154  	SupportHTTPRouteHostRewrite,
   155  	SupportHTTPRoutePathRewrite,
   156  	SupportHTTPRouteRequestMirror,
   157  	SupportHTTPRouteRequestMultipleMirrors,
   158  	SupportHTTPRouteRequestTimeout,
   159  	SupportHTTPRouteBackendTimeout,
   160  )
   161  
   162  // -----------------------------------------------------------------------------
   163  // Features - HTTPRoute Conformance (Experimental)
   164  // -----------------------------------------------------------------------------
   165  
   166  const (
   167  	// This option indicates support for Destination Port matching.
   168  	SupportHTTPRouteDestinationPortMatching SupportedFeature = "HTTPRouteDestinationPortMatching"
   169  )
   170  
   171  // HTTPRouteExperimentalFeatures includes all the supported experimental features, currently only
   172  // available in our experimental release channel.
   173  // Implementations have the flexibility to opt-in for either specific features or the entire set.
   174  var HTTPRouteExperimentalFeatures = sets.New(
   175  	SupportHTTPRouteDestinationPortMatching,
   176  	SupportHTTPRouteBackendProtocolH2C,
   177  	SupportHTTPRouteBackendProtocolWebSocket,
   178  )
   179  
   180  // -----------------------------------------------------------------------------
   181  // Features - TLSRoute Conformance (Core)
   182  // -----------------------------------------------------------------------------
   183  
   184  const (
   185  	// This option indicates support for TLSRoute
   186  	SupportTLSRoute SupportedFeature = "TLSRoute"
   187  )
   188  
   189  // TLSCoreFeatures includes all the supported features for the TLSRoute API at
   190  // a Core level of support.
   191  var TLSRouteCoreFeatures = sets.New(
   192  	SupportTLSRoute,
   193  )
   194  
   195  // -----------------------------------------------------------------------------
   196  // Features - Mesh Conformance (Core)
   197  // -----------------------------------------------------------------------------
   198  
   199  const (
   200  	// This option indicates general support for service mesh
   201  	SupportMesh SupportedFeature = "Mesh"
   202  )
   203  
   204  // MeshCoreFeatures includes all the supported features for the service mesh at
   205  // a Core level of support.
   206  var MeshCoreFeatures = sets.New(
   207  	SupportMesh,
   208  )
   209  
   210  // -----------------------------------------------------------------------------
   211  // Features - Compilations
   212  // -----------------------------------------------------------------------------
   213  
   214  // AllFeatures contains all the supported features and can be used to run all
   215  // conformance tests with `all-features` flag.
   216  //
   217  // NOTE: as new feature sets are added they should be inserted into this set.
   218  var AllFeatures = sets.New[SupportedFeature]().
   219  	Insert(GatewayExtendedFeatures.UnsortedList()...).
   220  	Insert(ReferenceGrantCoreFeatures.UnsortedList()...).
   221  	Insert(HTTPRouteCoreFeatures.UnsortedList()...).
   222  	Insert(HTTPRouteExtendedFeatures.UnsortedList()...).
   223  	Insert(HTTPRouteExperimentalFeatures.UnsortedList()...).
   224  	Insert(TLSRouteCoreFeatures.UnsortedList()...).
   225  	Insert(MeshCoreFeatures.UnsortedList()...)