@@ -4,7 +4,7 @@ use super::common::*;
44#[ allow( unused_imports) ]
55mod prelude {
66 pub use k8s_openapi:: apimachinery:: pkg:: apis:: meta:: v1:: Condition ;
7- pub use kube_derive :: CustomResource ;
7+ pub use kube :: CustomResource ;
88 pub use schemars:: JsonSchema ;
99 pub use serde:: { Deserialize , Serialize } ;
1010}
@@ -13,21 +13,20 @@ use self::prelude::*;
1313#[ derive( CustomResource , Serialize , Deserialize , Clone , Debug , JsonSchema , Default , PartialEq ) ]
1414#[ kube(
1515 group = "gateway.networking.k8s.io" ,
16- version = "v1alpha2 " ,
16+ version = "v1alpha3 " ,
1717 kind = "TLSRoute" ,
1818 plural = "tlsroutes"
1919) ]
20- #[ kube( crates( kube_core = "::kube_core" ) ) ]
2120#[ kube( namespaced) ]
22- #[ kube( status = "RouteStatus " ) ]
21+ #[ kube( status = "TlsRouteStatus " ) ]
2322#[ kube( derive = "Default" ) ]
2423#[ kube( derive = "PartialEq" ) ]
25- pub struct TLSRouteSpec {
26- /// Hostnames defines a set of SNI names that should match against the
24+ pub struct TlsRouteSpec {
25+ /// Hostnames defines a set of SNI hostnames that should match against the
2726 /// SNI attribute of TLS ClientHello message in TLS handshake. This matches
2827 /// the RFC 1123 definition of a hostname with 2 notable exceptions:
2928 ///
30- /// 1. IPs are not allowed in SNI names per RFC 6066.
29+ /// 1. IPs are not allowed in SNI hostnames per RFC 6066.
3130 /// 2. A hostname may be prefixed with a wildcard label (`*.`). The wildcard
3231 /// label must appear by itself as the first label.
3332 ///
@@ -36,13 +35,13 @@ pub struct TLSRouteSpec {
3635 /// attached to the Listener. For example:
3736 ///
3837 /// * A Listener with `test.example.com` as the hostname matches TLSRoutes
39- /// that have either not specified any hostnames, or have specified at
40- /// least one of `test.example.com` or `*.example.com`.
38+ /// that have specified at least one of `test.example.com` or
39+ /// `*.example.com`.
4140 /// * A Listener with `*.example.com` as the hostname matches TLSRoutes
42- /// that have either not specified any hostnames or have specified at least
43- /// one hostname that matches the Listener hostname. For example,
44- /// `test. example.com` and `* .example.com ` would both match. On the other
45- /// hand, `example.com` and `test.example.net` would not match.
41+ /// that have specified at least one hostname that matches the Listener
42+ /// hostname. For example, `test.example.com` and `*.example.com` would both
43+ /// match. On the other hand, ` example.com` and `test .example.net ` would not
44+ /// match.
4645 ///
4746 /// If both the Listener and TLSRoute have specified hostnames, any
4847 /// TLSRoute hostnames that do not match the Listener hostname MUST be
@@ -56,8 +55,7 @@ pub struct TLSRouteSpec {
5655 /// `False` in the corresponding RouteParentStatus.
5756 ///
5857 /// Support: Core
59- #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
60- pub hostnames : Option < Vec < String > > ,
58+ pub hostnames : Vec < String > ,
6159 /// ParentRefs references the resources (usually Gateways) that a Route wants
6260 /// to be attached to. Note that the referenced parent resource needs to
6361 /// allow this for the attachment to be complete. For Gateways, that means
@@ -119,20 +117,121 @@ pub struct TLSRouteSpec {
119117 /// connections originating from the same namespace as the Route, for which
120118 /// the intended destination of the connections are a Service targeted as a
121119 /// ParentRef of the Route.
122- ///
123- ///
124- ///
125- ///
126- ///
127- ///
128120 #[ serde(
129121 default ,
130122 skip_serializing_if = "Option::is_none" ,
131123 rename = "parentRefs"
132124 ) ]
133- pub parent_refs : Option < Vec < ParentReference > > ,
134- /// Rules are a list of TLS matchers and actions.
135- ///
136- ///
137- pub rules : Vec < CommonRouteRule > ,
125+ pub parent_refs : Option < Vec < HttpRouteParentRefs > > ,
126+ /// Rules are a list of actions.
127+ pub rules : Vec < TlsRouteRules > ,
128+ /// UseDefaultGateways indicates the default Gateway scope to use for this
129+ /// Route. If unset (the default) or set to None, the Route will not be
130+ /// attached to any default Gateway; if set, it will be attached to any
131+ /// default Gateway supporting the named scope, subject to the usual rules
132+ /// about which Routes a Gateway is allowed to claim.
133+ ///
134+ /// Think carefully before using this functionality! The set of default
135+ /// Gateways supporting the requested scope can change over time without
136+ /// any notice to the Route author, and in many situations it will not be
137+ /// appropriate to request a default Gateway for a given Route -- for
138+ /// example, a Route with specific security requirements should almost
139+ /// certainly not use a default Gateway.
140+ #[ serde(
141+ default ,
142+ skip_serializing_if = "Option::is_none" ,
143+ rename = "useDefaultGateways"
144+ ) ]
145+ pub use_default_gateways : Option < GatewayDefaultScope > ,
146+ }
147+ /// TLSRouteRule is the configuration for a given rule.
148+ #[ derive( Serialize , Deserialize , Clone , Debug , JsonSchema , Default , PartialEq ) ]
149+ pub struct TlsRouteRules {
150+ /// BackendRefs defines the backend(s) where matching requests should be
151+ /// sent. If unspecified or invalid (refers to a nonexistent resource or
152+ /// a Service with no endpoints), the rule performs no forwarding; if no
153+ /// filters are specified that would result in a response being sent, the
154+ /// underlying implementation must actively reject request attempts to this
155+ /// backend, by rejecting the connection or returning a 500 status code.
156+ /// Request rejections must respect weight; if an invalid backend is
157+ /// requested to have 80% of requests, then 80% of requests must be rejected
158+ /// instead.
159+ ///
160+ /// Support: Core for Kubernetes Service
161+ ///
162+ /// Support: Extended for Kubernetes ServiceImport
163+ ///
164+ /// Support: Implementation-specific for any other resource
165+ ///
166+ /// Support for weight: Extended
167+ #[ serde( rename = "backendRefs" ) ]
168+ pub backend_refs : Vec < TcpRouteRulesBackendRefs > ,
169+ /// Name is the name of the route rule. This name MUST be unique within a Route if it is set.
170+ ///
171+ /// Support: Extended
172+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
173+ pub name : Option < String > ,
174+ }
175+ /// Status defines the current state of TLSRoute.
176+ #[ derive( Serialize , Deserialize , Clone , Debug , JsonSchema , Default , PartialEq ) ]
177+ pub struct TlsRouteStatus {
178+ /// Parents is a list of parent resources (usually Gateways) that are
179+ /// associated with the route, and the status of the route with respect to
180+ /// each parent. When this route attaches to a parent, the controller that
181+ /// manages the parent must add an entry to this list when the controller
182+ /// first sees the route and should update the entry as appropriate when the
183+ /// route or gateway is modified.
184+ ///
185+ /// Note that parent references that cannot be resolved by an implementation
186+ /// of this API will not be added to this list. Implementations of this API
187+ /// can only populate Route status for the Gateways/parent resources they are
188+ /// responsible for.
189+ ///
190+ /// A maximum of 32 Gateways will be represented in this list. An empty list
191+ /// means the route has not been attached to any Gateway.
192+ pub parents : Vec < TlsRouteStatusParents > ,
193+ }
194+ /// RouteParentStatus describes the status of a route with respect to an
195+ /// associated Parent.
196+ #[ derive( Serialize , Deserialize , Clone , Debug , JsonSchema , Default , PartialEq ) ]
197+ pub struct TlsRouteStatusParents {
198+ /// Conditions describes the status of the route with respect to the Gateway.
199+ /// Note that the route's availability is also subject to the Gateway's own
200+ /// status conditions and listener status.
201+ ///
202+ /// If the Route's ParentRef specifies an existing Gateway that supports
203+ /// Routes of this kind AND that Gateway's controller has sufficient access,
204+ /// then that Gateway's controller MUST set the "Accepted" condition on the
205+ /// Route, to indicate whether the route has been accepted or rejected by the
206+ /// Gateway, and why.
207+ ///
208+ /// A Route MUST be considered "Accepted" if at least one of the Route's
209+ /// rules is implemented by the Gateway.
210+ ///
211+ /// There are a number of cases where the "Accepted" condition may not be set
212+ /// due to lack of controller visibility, that includes when:
213+ ///
214+ /// * The Route refers to a nonexistent parent.
215+ /// * The Route is of a type that the controller does not support.
216+ /// * The Route is in a namespace the controller does not have access to.
217+ pub conditions : Vec < Condition > ,
218+ /// ControllerName is a domain/path string that indicates the name of the
219+ /// controller that wrote this status. This corresponds with the
220+ /// controllerName field on GatewayClass.
221+ ///
222+ /// Example: "example.net/gateway-controller".
223+ ///
224+ /// The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are
225+ /// valid Kubernetes names
226+ /// (<https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).>
227+ ///
228+ /// Controllers MUST populate this field when writing status. Controllers should ensure that
229+ /// entries to status populated with their ControllerName are cleaned up when they are no
230+ /// longer necessary.
231+ #[ serde( rename = "controllerName" ) ]
232+ pub controller_name : String ,
233+ /// ParentRef corresponds with a ParentRef in the spec that this
234+ /// RouteParentStatus struct describes the status of.
235+ #[ serde( rename = "parentRef" ) ]
236+ pub parent_ref : HttpRouteParentRefs ,
138237}
0 commit comments