1 /* 2 Copyright 2020 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 v1beta1 18 19 import ( 20 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 22 v1 "sigs.k8s.io/gateway-api/apis/v1" 23 ) 24 25 // +genclient 26 // +kubebuilder:object:root=true 27 // +kubebuilder:resource:categories=gateway-api 28 // +kubebuilder:storageversion 29 // +kubebuilder:subresource:status 30 // +kubebuilder:printcolumn:name="Hostnames",type=string,JSONPath=`.spec.hostnames` 31 // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` 32 33 // HTTPRoute provides a way to route HTTP requests. This includes the capability 34 // to match requests by hostname, path, header, or query param. Filters can be 35 // used to specify additional processing steps. Backends specify where matching 36 // requests should be routed. 37 type HTTPRoute v1.HTTPRoute 38 39 // +kubebuilder:object:root=true 40 41 // HTTPRouteList contains a list of HTTPRoute. 42 type HTTPRouteList struct { 43 metav1.TypeMeta `json:",inline"` 44 metav1.ListMeta `json:"metadata,omitempty"` 45 Items []HTTPRoute `json:"items"` 46 } 47 48 // HTTPRouteSpec defines the desired state of HTTPRoute 49 // +k8s:deepcopy-gen=false 50 type HTTPRouteSpec = v1.HTTPRouteSpec 51 52 // HTTPRouteRule defines semantics for matching an HTTP request based on 53 // conditions (matches), processing it (filters), and forwarding the request to 54 // an API object (backendRefs). 55 // +k8s:deepcopy-gen=false 56 type HTTPRouteRule = v1.HTTPRouteRule 57 58 // PathMatchType specifies the semantics of how HTTP paths should be compared. 59 // Valid PathMatchType values, along with their conformance level, are: 60 // 61 // * "Exact" - Core 62 // * "PathPrefix" - Core 63 // * "RegularExpression" - Implementation Specific 64 // 65 // PathPrefix and Exact paths must be syntactically valid: 66 // 67 // - Must begin with the `/` character 68 // - Must not contain consecutive `/` characters (e.g. `/foo///`, `//`). 69 // 70 // Note that values may be added to this enum, implementations 71 // must ensure that unknown values will not cause a crash. 72 // 73 // Unknown values here must result in the implementation setting the 74 // Accepted Condition for the Route to `status: False`, with a 75 // Reason of `UnsupportedValue`. 76 // 77 // +kubebuilder:validation:Enum=Exact;PathPrefix;RegularExpression 78 // +k8s:deepcopy-gen=false 79 type PathMatchType = v1.PathMatchType 80 81 // HTTPPathMatch describes how to select a HTTP route by matching the HTTP request path. 82 // +k8s:deepcopy-gen=false 83 type HTTPPathMatch = v1.HTTPPathMatch 84 85 // HeaderMatchType specifies the semantics of how HTTP header values should be 86 // compared. Valid HeaderMatchType values, along with their conformance levels, are: 87 // 88 // * "Exact" - Core 89 // * "RegularExpression" - Implementation Specific 90 // 91 // Note that values may be added to this enum, implementations 92 // must ensure that unknown values will not cause a crash. 93 // 94 // Unknown values here must result in the implementation setting the 95 // Accepted Condition for the Route to `status: False`, with a 96 // Reason of `UnsupportedValue`. 97 // 98 // +kubebuilder:validation:Enum=Exact;RegularExpression 99 // +k8s:deepcopy-gen=false 100 type HeaderMatchType = v1.HeaderMatchType 101 102 // HTTPHeaderName is the name of an HTTP header. 103 // 104 // Valid values include: 105 // * "Authorization" 106 // * "Set-Cookie" 107 // 108 // Invalid values include: 109 // 110 // - ":method" - ":" is an invalid character. This means that HTTP/2 pseudo 111 // headers are not currently supported by this type. 112 // 113 // * "/invalid" - "/" is an invalid character 114 // +k8s:deepcopy-gen=false 115 type HTTPHeaderName = v1.HeaderName 116 117 // HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request 118 // headers. 119 // +k8s:deepcopy-gen=false 120 type HTTPHeaderMatch = v1.HTTPHeaderMatch 121 122 // QueryParamMatchType specifies the semantics of how HTTP query parameter 123 // values should be compared. Valid QueryParamMatchType values, along with their 124 // conformance levels, are: 125 // 126 // * "Exact" - Core 127 // * "RegularExpression" - Implementation Specific 128 // 129 // Note that values may be added to this enum, implementations 130 // must ensure that unknown values will not cause a crash. 131 // 132 // Unknown values here must result in the implementation setting the 133 // Accepted Condition for the Route to `status: False`, with a 134 // Reason of `UnsupportedValue`. 135 // 136 // +kubebuilder:validation:Enum=Exact;RegularExpression 137 // +k8s:deepcopy-gen=false 138 type QueryParamMatchType = v1.QueryParamMatchType 139 140 // HTTPQueryParamMatch describes how to select a HTTP route by matching HTTP 141 // query parameters. 142 // +k8s:deepcopy-gen=false 143 type HTTPQueryParamMatch = v1.HTTPQueryParamMatch 144 145 // HTTPMethod describes how to select a HTTP route by matching the HTTP 146 // method as defined by 147 // [RFC 7231](https://datatracker.ietf.org/doc/html/rfc7231#section-4) and 148 // [RFC 5789](https://datatracker.ietf.org/doc/html/rfc5789#section-2). 149 // The value is expected in upper case. 150 // 151 // Note that values may be added to this enum, implementations 152 // must ensure that unknown values will not cause a crash. 153 // 154 // Unknown values here must result in the implementation setting the 155 // Accepted Condition for the Route to `status: False`, with a 156 // Reason of `UnsupportedValue`. 157 // 158 // +kubebuilder:validation:Enum=GET;HEAD;POST;PUT;DELETE;CONNECT;OPTIONS;TRACE;PATCH 159 // +k8s:deepcopy-gen=false 160 type HTTPMethod = v1.HTTPMethod 161 162 // HTTPRouteMatch defines the predicate used to match requests to a given 163 // action. Multiple match types are ANDed together, i.e. the match will 164 // evaluate to true only if all conditions are satisfied. 165 // 166 // For example, the match below will match a HTTP request only if its path 167 // starts with `/foo` AND it contains the `version: v1` header: 168 // 169 // ``` 170 // match: 171 // 172 // path: 173 // value: "/foo" 174 // headers: 175 // - name: "version" 176 // value "v1" 177 // 178 // ``` 179 // +k8s:deepcopy-gen=false 180 type HTTPRouteMatch = v1.HTTPRouteMatch 181 182 // HTTPRouteFilter defines processing steps that must be completed during the 183 // request or response lifecycle. HTTPRouteFilters are meant as an extension 184 // point to express processing that may be done in Gateway implementations. Some 185 // examples include request or response modification, implementing 186 // authentication strategies, rate-limiting, and traffic shaping. API 187 // guarantee/conformance is defined based on the type of the filter. 188 // +k8s:deepcopy-gen=false 189 type HTTPRouteFilter = v1.HTTPRouteFilter 190 191 // HTTPRouteFilterType identifies a type of HTTPRoute filter. 192 // +k8s:deepcopy-gen=false 193 type HTTPRouteFilterType = v1.HTTPRouteFilterType 194 195 // HTTPRouteTimeouts defines timeouts that can be configured for an HTTPRoute. 196 // +k8s:deepcopy-gen=false 197 type HTTPRouteTimeouts = v1.HTTPRouteTimeouts 198 199 // HTTPHeader represents an HTTP Header name and value as defined by RFC 7230. 200 // +k8s:deepcopy-gen=false 201 type HTTPHeader = v1.HTTPHeader 202 203 // HTTPHeaderFilter defines a filter that modifies the headers of an HTTP request 204 // or response. 205 // +k8s:deepcopy-gen=false 206 type HTTPHeaderFilter = v1.HTTPHeaderFilter 207 208 // HTTPPathModifierType defines the type of path redirect or rewrite. 209 // +k8s:deepcopy-gen=false 210 type HTTPPathModifierType = v1.HTTPPathModifierType 211 212 // HTTPPathModifier defines configuration for path modifiers. 213 // <gateway:experimental> 214 // +k8s:deepcopy-gen=false 215 type HTTPPathModifier = v1.HTTPPathModifier 216 217 // HTTPRequestRedirect defines a filter that redirects a request. This filter 218 // MUST NOT be used on the same Route rule as a HTTPURLRewrite filter. 219 // +k8s:deepcopy-gen=false 220 type HTTPRequestRedirectFilter = v1.HTTPRequestRedirectFilter 221 222 // HTTPURLRewriteFilter defines a filter that modifies a request during 223 // forwarding. At most one of these filters may be used on a Route rule. This 224 // MUST NOT be used on the same Route rule as a HTTPRequestRedirect filter. 225 // 226 // Support: Extended 227 // 228 // <gateway:experimental> 229 // +k8s:deepcopy-gen=false 230 type HTTPURLRewriteFilter = v1.HTTPURLRewriteFilter 231 232 // HTTPRequestMirrorFilter defines configuration for the RequestMirror filter. 233 // +k8s:deepcopy-gen=false 234 type HTTPRequestMirrorFilter = v1.HTTPRequestMirrorFilter 235 236 // HTTPBackendRef defines how a HTTPRoute should forward an HTTP request. 237 // +k8s:deepcopy-gen=false 238 type HTTPBackendRef = v1.HTTPBackendRef 239 240 // HTTPRouteStatus defines the observed state of HTTPRoute. 241 // +k8s:deepcopy-gen=false 242 type HTTPRouteStatus = v1.HTTPRouteStatus 243