Finalize
less than a minute
A specialized combination of Pepr’s Mutate & Watch functionalities that allow a module author to run logic while Kubernetes is Finalizing a resource (i.e. cleaning up related resources after a deleteion request has been accepted). Finalize()
can only be accessed after a Watch()
or Reconcile()
.
This method will:
Inject a finalizer into the
metadata.finalizers
field of the requested resource during the mutation phase of the admission.Watch appropriate resource lifecycle events & invoke the given callback.
Remove the injected finalizer from the
metadata.finalizers
field of the requested resource.
When(a.ConfigMap)
.IsCreated()
.InNamespace("hello-pepr-finalize-create")
.WithName("cm-reconcile-create")
.Reconcile(function reconcileCreate(cm) {
Log.info(cm, "external api call (create): reconcile/callback")
})
.Finalize(function finalizeCreate(cm) {
Log.info(cm, "external api call (create): reconcile/finalize")
});