pub struct HTTPRouteSpec {
pub hostnames: Option<Vec<String>>,
pub parent_refs: Option<Vec<HTTPRouteParentRefs>>,
pub rules: Option<Vec<HTTPRouteRules>>,
}
Expand description
Spec defines the desired state of HTTPRoute.
Fields§
§hostnames: Option<Vec<String>>
Hostnames defines a set of hostnames that should match against the HTTP Host header to select a HTTPRoute used to process the request. Implementations MUST ignore any port value specified in the HTTP Host header while performing a match and (absent of any applicable header modification configuration) MUST forward this header unmodified to the backend.
Valid values for Hostnames are determined by RFC 1123 definition of a hostname with 2 notable exceptions:
- IPs are not allowed.
- A hostname may be prefixed with a wildcard label (
*.
). The wildcard label must appear by itself as the first label.
If a hostname is specified by both the Listener and HTTPRoute, there must be at least one intersecting hostname for the HTTPRoute to be attached to the Listener. For example:
- A Listener with
test.example.com
as the hostname matches HTTPRoutes that have either not specified any hostnames, or have specified at least one oftest.example.com
or*.example.com
. - A Listener with
*.example.com
as the hostname matches HTTPRoutes that have either not specified any hostnames or have specified at least one hostname that matches the Listener hostname. For example,*.example.com
,test.example.com
, andfoo.test.example.com
would all match. On the other hand,example.com
andtest.example.net
would not match.
Hostnames that are prefixed with a wildcard label (*.
) are interpreted
as a suffix match. That means that a match for *.example.com
would match
both test.example.com
, and foo.test.example.com
, but not example.com
.
If both the Listener and HTTPRoute have specified hostnames, any
HTTPRoute hostnames that do not match the Listener hostname MUST be
ignored. For example, if a Listener specified *.example.com
, and the
HTTPRoute specified test.example.com
and test.example.net
,
test.example.net
must not be considered for a match.
If both the Listener and HTTPRoute have specified hostnames, and none
match with the criteria above, then the HTTPRoute is not accepted. The
implementation must raise an ‘Accepted’ Condition with a status of
False
in the corresponding RouteParentStatus.
In the event that multiple HTTPRoutes specify intersecting hostnames (e.g. overlapping wildcard matching and exact matching hostnames), precedence must be given to rules from the HTTPRoute with the largest number of:
- Characters in a matching non-wildcard hostname.
- Characters in a matching hostname.
If ties exist across multiple Routes, the matching precedence rules for HTTPRouteMatches takes over.
Support: Core
parent_refs: Option<Vec<HTTPRouteParentRefs>>
ParentRefs references the resources (usually Gateways) that a Route wants to be attached to. Note that the referenced parent resource needs to allow this for the attachment to be complete. For Gateways, that means the Gateway needs to allow attachment from Routes of this kind and namespace. For Services, that means the Service must either be in the same namespace for a “producer” route, or the mesh implementation must support and allow “consumer” routes for the referenced Service. ReferenceGrant is not applicable for governing ParentRefs to Services - it is not possible to create a “producer” route for a Service in a different namespace from the Route.
There are two kinds of parent resources with “Core” support:
- Gateway (Gateway conformance profile)
- Service (Mesh conformance profile, ClusterIP Services only)
This API may be extended in the future to support additional kinds of parent resources.
ParentRefs must be distinct. This means either that:
- They select different objects. If this is the case, then parentRef
entries are distinct. In terms of fields, this means that the
multi-part key defined by
group
,kind
,namespace
, andname
must be unique across all parentRef entries in the Route. - They do not select different objects, but for each optional field used, each ParentRef that selects the same object must set the same set of optional fields to different values. If one ParentRef sets a combination of optional fields, all must set the same combination.
Some examples:
- If one ParentRef sets
sectionName
, all ParentRefs referencing the same object must also setsectionName
. - If one ParentRef sets
port
, all ParentRefs referencing the same object must also setport
. - If one ParentRef sets
sectionName
andport
, all ParentRefs referencing the same object must also setsectionName
andport
.
It is possible to separately reference multiple distinct objects that may be collapsed by an implementation. For example, some implementations may choose to merge compatible Gateway Listeners together. If that is the case, the list of routes attached to those resources should also be merged.
Note that for ParentRefs that cross namespace boundaries, there are specific rules. Cross-namespace references are only valid if they are explicitly allowed by something in the namespace they are referring to. For example, Gateway has the AllowedRoutes field, and ReferenceGrant provides a generic way to enable other kinds of cross-namespace reference.
ParentRefs from a Route to a Service in the same namespace are “producer” routes, which apply default routing rules to inbound connections from any namespace to the Service.
ParentRefs from a Route to a Service in a different namespace are “consumer” routes, and these routing rules are only applied to outbound connections originating from the same namespace as the Route, for which the intended destination of the connections are a Service targeted as a ParentRef of the Route.
rules: Option<Vec<HTTPRouteRules>>
Rules are a list of HTTP matchers, filters and actions.
Trait Implementations§
Source§impl Clone for HTTPRouteSpec
impl Clone for HTTPRouteSpec
Source§fn clone(&self) -> HTTPRouteSpec
fn clone(&self) -> HTTPRouteSpec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for HTTPRouteSpec
impl Debug for HTTPRouteSpec
Source§impl Default for HTTPRouteSpec
impl Default for HTTPRouteSpec
Source§fn default() -> HTTPRouteSpec
fn default() -> HTTPRouteSpec
Source§impl<'de> Deserialize<'de> for HTTPRouteSpec
impl<'de> Deserialize<'de> for HTTPRouteSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for HTTPRouteSpec
impl JsonSchema for HTTPRouteSpec
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moreSource§impl PartialEq for HTTPRouteSpec
impl PartialEq for HTTPRouteSpec
Source§impl Serialize for HTTPRouteSpec
impl Serialize for HTTPRouteSpec
impl StructuralPartialEq for HTTPRouteSpec
Auto Trait Implementations§
impl Freeze for HTTPRouteSpec
impl RefUnwindSafe for HTTPRouteSpec
impl Send for HTTPRouteSpec
impl Sync for HTTPRouteSpec
impl Unpin for HTTPRouteSpec
impl UnwindSafe for HTTPRouteSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more