pub struct IngressRule {
pub host: String,
pub path: String,
pub path_type: PathType,
pub service_name: String,
pub service_port: u16,
pub namespace: String,
}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
Source§fn eq(&self, other: &IngressRule) -> bool
fn eq(&self, other: &IngressRule) -> bool
Tests for
self and other values to be equal, and is used by ==.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