pub struct Backend {
pub id: BackendId,
pub lb: LbPolicy,
}
Expand description
A Backend is a logical target for network traffic.
A backend configures how all traffic for its target
is handled. Any
traffic routed to this backend will use the configured load balancing policy
to spread traffic across available endpoints.
Fields§
§id: BackendId
A unique identifier for this backend.
lb: LbPolicy
How traffic to this target should be load balanced.
Implementations§
Source§impl Backend
impl Backend
Sourcepub fn to_service_patch(&self) -> Service
pub fn to_service_patch(&self) -> Service
Generate a partial Service from this backend.
This service can be used to patch and overwrite an existing Service
using the kube
crate or saved as json/yaml and used to patch an
existing service with kubectl patch
.
Sourcepub fn from_service(svc: &Service) -> Result<Vec<Self>, Error>
pub fn from_service(svc: &Service) -> Result<Vec<Self>, Error>
Read one or more Backends from a Kubernetes Service. A backend will be generated for every distinct port the Service is configured with.
The type of Backend generated depends on the Service.
-
ClusterIP
Services are translated to backends with a KubeService target and that use theport
of the Service and the address of each endpoint.ClusterIP
services must not be configured as headless services, so that endpoint information is available. -
ExternalName
Services are translated to backends with a Dns target, and uses the service port as the target port. If no port is specified, backends are generated for ports 80 and 443.
All other Service types are currently unsupported.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Backend
impl<'de> Deserialize<'de> for Backend
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>,
impl StructuralPartialEq for Backend
Auto Trait Implementations§
impl Freeze for Backend
impl RefUnwindSafe for Backend
impl Send for Backend
impl Sync for Backend
impl Unpin for Backend
impl UnwindSafe for Backend
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request