pub struct IngressRule {
pub host: String,
pub path: String,
pub path_type: PathType,
pub service_name: String,
pub service_port: u16,
pub namespace: String,
}Available on non-WebAssembly only.
Expand description
A single routing rule parsed from a Kubernetes Ingress resource.
Fields§
§host: StringValue of spec.rules[].host. Empty string means match-all.
path: StringValue of spec.rules[].http.paths[].path.
path_type: PathTypeValue of spec.rules[].http.paths[].pathType. Defaults to
PathType::Prefix if the field is absent.
service_name: StringKubernetes service name (spec.rules[].http.paths[].backend.service.name).
service_port: u16Kubernetes service port number.
namespace: StringNamespace the Ingress lives in.
Implementations§
Source§impl IngressRule
impl IngressRule
Sourcepub fn upstream_addr(&self) -> String
pub fn upstream_addr(&self) -> String
Build the upstream Kubernetes DNS address.
Returns "{service_name}.{namespace}.svc.cluster.local:{service_port}".
Sourcepub fn matches(&self, host: &str, uri: &str) -> bool
pub fn matches(&self, host: &str, uri: &str) -> bool
Returns true if this rule matches the given host header value and
request uri.
- If
self.hostis non-empty, the incominghostmust match (case-insensitive). - Any query string on
uriis ignored for path matching. PathType::Exactrequires the request path to equalself.pathexactly.PathType::Prefix(andPathType::ImplementationSpecific) match on whole path segments —/foomatches/foo,/foo/, and/foo/bar, but not/foobar— not a raw byte prefix.
Trait Implementations§
Source§impl Clone for IngressRule
impl Clone for IngressRule
Source§fn clone(&self) -> IngressRule
fn clone(&self) -> IngressRule
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for IngressRule
impl Debug for IngressRule
Source§impl PartialEq for IngressRule
impl PartialEq for IngressRule
impl StructuralPartialEq for IngressRule
Auto Trait Implementations§
impl Freeze for IngressRule
impl RefUnwindSafe for IngressRule
impl Send for IngressRule
impl Sync for IngressRule
impl Unpin for IngressRule
impl UnsafeUnpin for IngressRule
impl UnwindSafe for IngressRule
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Available on crate feature
map-response-body only.Apply a transformation to the response body. Read more
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using HTTP status codes. Read more
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using gRPC headers. Read more