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: BackendIdA unique identifier for this backend.
lb: LbPolicyHow 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.
-
ClusterIPServices are translated to backends with a KubeService target and that use theportof the Service and the address of each endpoint.ClusterIPservices must not be configured as headless services, so that endpoint information is available. -
ExternalNameServices 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