Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStatusUpdater ¶
func NewStatusUpdater[S Status[S]](rsrc resource[S]) *statusUpdater[S]
NewStatusUpdater returns a status updater meant for updating the status of the supplied resource when the updater is closed. Typically users will want to create a status updater early on in a controller's Reconcile() method and add a deferred method to close the updater when returning from reconcile.
i.e.
func (r *myController) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error) { rsrc := &MyResource{} if err := r.Get(ctx, req.NamespacedName, rsrc); err != nil { return err } updater := NewStatusUpdater[*MyResourceStatus](rsrc) defer func() { if err == nil { err = updater.Close(ctx, r) } }() ...
Types ¶
Click to show internal directories.
Click to hide internal directories.