Finalize

Trait Finalize 

Source
pub trait Finalize<R>: Send + Sync{
    // Required method
    fn client(&self) -> Client;

    // Provided methods
    fn finalize<'life0, 'life1, 'async_trait, ReconcileFut>(
        &'life0 self,
        finalizer_name: &'life1 str,
        object: Arc<R>,
        reconcile: impl 'async_trait + FnOnce(Event<R>) -> ReconcileFut + Send,
    ) -> Pin<Box<dyn Future<Output = Result<Action>> + Send + 'async_trait>>
       where ReconcileFut: TryFuture<Ok = Action> + Send + 'async_trait,
             ReconcileFut::Error: StdError + Send + 'static,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn update_status<'life0, 'life1, 'async_trait, S>(
        &'life0 self,
        object: &'life1 R,
        status: S,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where S: Serialize + ObserveGeneration + Debug + Send + Sync + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn update_status_with_error<'life0, 'life1, 'life2, 'async_trait, S, A, E>(
        &'life0 self,
        object: &'life1 R,
        status: S,
        error: Option<&'life2 A>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where S: Serialize + ObserveGeneration + WithStatusError<A, E> + Debug + Send + Sync + 'async_trait,
             A: AsStatusError<E> + Send + Sync + 'async_trait,
             E: Serialize + Debug + PartialEq + Clone + JsonSchema + for<'de> Deserialize<'de> + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

The Finalize trait takes care of the finalizers of a resource as well the reconciliation changes to the k8s resource itself.

This component needs to be implemented by a struct that is used by the Context component, something like a k8s repository, as it interacts with the k8s api directly.

Required Methods§

Source

fn client(&self) -> Client

Returns the k8s client that is used to interact with the k8s api.

Provided Methods§

Source

fn finalize<'life0, 'life1, 'async_trait, ReconcileFut>( &'life0 self, finalizer_name: &'life1 str, object: Arc<R>, reconcile: impl 'async_trait + FnOnce(Event<R>) -> ReconcileFut + Send, ) -> Pin<Box<dyn Future<Output = Result<Action>> + Send + 'async_trait>>
where ReconcileFut: TryFuture<Ok = Action> + Send + 'async_trait, ReconcileFut::Error: StdError + Send + 'static, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delegates the finalization logic to the kube::runtime::finalizer::finalizer function of the kube runtime by utilizing the reconcile function injected by the Context.

As this method is dealing with meta.finalizers of a component it might trigger a new reconiliation of the resource. This happens in case of the creation and the deletion of the resource.

Source

fn update_status<'life0, 'life1, 'async_trait, S>( &'life0 self, object: &'life1 R, status: S, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where S: Serialize + ObserveGeneration + Debug + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Updates the status object of a resource.

Updating the status does not trigger a new reconiliation loop.

Source

fn update_status_with_error<'life0, 'life1, 'life2, 'async_trait, S, A, E>( &'life0 self, object: &'life1 R, status: S, error: Option<&'life2 A>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where S: Serialize + ObserveGeneration + WithStatusError<A, E> + Debug + Send + Sync + 'async_trait, A: AsStatusError<E> + Send + Sync + 'async_trait, E: Serialize + Debug + PartialEq + Clone + JsonSchema + for<'de> Deserialize<'de> + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Updates the status object of a resource with an optional error.

Updating the status does not trigger a new reconiliation loop.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§