pub struct Reporter {
pub controller: String,
pub instance: Option<String>,
}
Expand description
Information about the reporting controller.
use kube::runtime::events::Reporter;
let reporter = Reporter {
controller: "my-awesome-controller".into(),
instance: std::env::var("CONTROLLER_POD_NAME").ok(),
};
Fields§
§controller: String
The name of the reporting controller that is publishing the event.
This is likely your deployment.metadata.name.
instance: Option<String>
The id of the controller publishing the event. Likely your pod name.
Useful when running more than one replica on your controller and you need to disambiguate where events came from.
The name of the controller pod can be retrieved using Kubernetes’ API or it can be injected as an environment variable using
env:
- name: CONTROLLER_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
in the manifest of your controller.
NB: If no instance
is provided, then reporting_instance == reporting_controller
in the Event
.
Trait Implementations§
impl Eq for Reporter
impl StructuralPartialEq for Reporter
Auto Trait Implementations§
impl Freeze for Reporter
impl RefUnwindSafe for Reporter
impl Send for Reporter
impl Sync for Reporter
impl Unpin for Reporter
impl UnwindSafe for Reporter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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 more