Documentation ¶
Index ¶
Constants ¶
const ( EventRequestStart = "ReconcileRequestStart" EventNotFound = "ReconcileNotFound" EventStart = "ReconcileStart" EventSkipped = "ReconcileSkipped" EventRequeued = "ReconcileRequeued" EventError = "ReconcileError" EventComplete = "ReconcileComplete" )
Variables ¶
This section is empty.
Functions ¶
func ResolveAndReconcile ¶
func ResolveAndReconcile(ctx context.Context, logger logr.Logger, mgr manager.Manager, objType runtime.Object, inner ObjectReconcileFunc) reconcile.Reconciler
ResolveAndReconcile helps avoid boilerplate where you would normally attempt to fetch your modified object at the start of a reconciliation loop, and instead calls an inner reconciliation function with the already resolved object.
Types ¶
type DiffFunc ¶
DiffFunc takes two Kubernetes resources: expected and existing. Both are assumed to be the same Kind. It compares the two, and returns an Outcome indicating how to transition from existing to expected. If an update is required, it will set the relevant fields on existing to their intended values. This is so that we can simply resubmit the existing resource, and any fields automatically set by the Kubernetes API server will be retained.
type ObjWithMeta ¶
ObjWithMeta describes a Kubernetes resource with a metadata field. It's a combination of two common existing Kubernetes interfaces. We do this because we want to use methods from each in CreateOrUpdate, whilst still keeping the argument type generic.
type ObjectReconcileFunc ¶
type ObjectReconcileFunc func(logger logr.Logger, request reconcile.Request, obj runtime.Object) (reconcile.Result, error)
ObjectReconcileFunc defines the expected interface for the reconciliation of a single object type- it can be used to avoid boilerplate for finding and initializing objects at the start of traditional reconciliation loops.
type Outcome ¶
type Outcome string
Outcome describes the operation performed by CreateOrUpdate.
func CreateOrUpdate ¶
func CreateOrUpdate(ctx context.Context, c client.Client, existing ObjWithMeta, diffFunc DiffFunc) (Outcome, error)
CreateOrUpdate takes a Kubernetes object and a "diff function" and attempts to ensure that the the object exists in the cluster with the correct state. It will use the diff function to determine any differences between the cluster state and the local state and use that to decide how to update it.
func DirectoryRoleBindingDiff ¶
DirectoryRoleBindingDiff is a DiffFunc for DirectoryRoleBindings