finalizerskeptcontext

package
v5.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 1 Imported by: 17

Documentation

Overview

Package finalizerskeptcontext stores and accesses the kept in context.Context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) (chan struct{}, bool)

FromContext returns the kept channel, if any.

func IsKept

func IsKept(ctx context.Context) bool

IsKept checks whether the given context obtains information about the kept channel as defined in this package, if any kept channel is present.

NOTE that the kept channel, if any found, is only used to be closed to signal keeping finalizers. It is not guaranteed that the channel is buffered or read from. Clients must not write to it. Otherwise the kept channel will block eventually. It is safe to signal keeping finalizers via SetKept.

func NewContext

func NewContext(ctx context.Context, v chan struct{}) context.Context

NewContext returns a new context.Context that carries value v.

func SetKept

func SetKept(ctx context.Context)

SetKept is a safe way to signal keeping finalizers. When operators manage the deletion of resources they use finalizers out of the box when using the operatorkit controller. On deletion operators might want to replay the deletion process. This is achieved by not removing finalizers from the observed runtime object. So instead of returning an error and abusing errors for control flow, SetKept can be used to signal the operatorkit controller to not remove finalizers at the end of the current reconciliation loop. Most likely resource cancelation is desired to be used in combination with SetKept. Context based functionality can be composed like the following.

finalizerskeptcontext.SetKept(ctx)
resourcecanceledcontext.SetCanceled(ctx)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL