Skip to main content

Controller

Trait Controller 

Source
pub trait Controller: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn tick<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<ReconcileOutcome, ControllerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn controller_type(&self) -> ControllerType { ... }
}
Expand description

One controller — implements the standard reconcile-loop shape.

Required Methods§

Source

fn name(&self) -> &'static str

Stable name for telemetry + runtime registration.

Source

fn tick<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ReconcileOutcome, ControllerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

One reconcile tick. Returns a typed ReconcileOutcome so the runtime can log the ReconcileReport AND act on the ReconcileResult (requeue decision). A controller that does not opt into requeue returns ReconcileResult::Done (the default), which the drivers treat exactly as the pre-unification counter-only behavior.

Provided Methods§

Source

fn controller_type(&self) -> ControllerType

The type that does this controller’s reconciling (T5.11).

The default names Self. An adapter that only forwards to another controller — Arc<C> here, the runtime’s DeclaredHere — forwards this too, so what the runtime records for a driver is the type it really runs, not the wrapper around it. Through a dyn Controller it is the concrete type behind the object.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<C: Controller + ?Sized> Controller for Arc<C>

Blanket impl so an Arc<C> is itself a Controller. This lets a caller keep an Arc<C> handle (e.g. the kubelet, queried in-process by the apiserver’s /log subresource) AND hand the SAME controller to a crate::WatchDriver (which takes its controller by value + re-wraps it in an Arc). Both share one instance — the driver’s ticks and the out-of-band queries see the same internal state.

Source§

fn name(&self) -> &'static str

Source§

fn tick<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ReconcileOutcome, ControllerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn controller_type(&self) -> ControllerType

Implementors§