reconcilers

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOnlyMutator

func CreateOnlyMutator(existing, desired client.Object) (bool, error)

Types

type BaseReconciler

type BaseReconciler struct {
	// contains filtered or unexported fields
}

func NewBaseReconciler

func NewBaseReconciler(
	client client.Client, scheme *runtime.Scheme, apiClientReader client.Reader,
	logger logr.Logger, recorder record.EventRecorder) *BaseReconciler

func (*BaseReconciler) APIClientReader

func (b *BaseReconciler) APIClientReader() client.Reader

APIClientReader return a client that directly reads objects from the Kubernetes APIServer

func (*BaseReconciler) Client

func (b *BaseReconciler) Client() client.Client

Client returns a split client that reads objects from the cache and writes to the Kubernetes APIServer

func (*BaseReconciler) CreateResource

func (b *BaseReconciler) CreateResource(ctx context.Context, obj client.Object) error

func (*BaseReconciler) DeleteResource

func (b *BaseReconciler) DeleteResource(ctx context.Context, obj client.Object, options ...client.DeleteOption) error

func (*BaseReconciler) EnsureOwnerReference

func (b *BaseReconciler) EnsureOwnerReference(owner, obj client.Object) (bool, error)

EnsureOwnerReference sets owner as a Controller OwnerReference on owned returns boolean to notify when the object has been updated

func (*BaseReconciler) EventRecorder

func (b *BaseReconciler) EventRecorder() record.EventRecorder

func (*BaseReconciler) GetResource

func (b *BaseReconciler) GetResource(ctx context.Context, objKey types.NamespacedName, obj client.Object) error

func (*BaseReconciler) Logger

func (b *BaseReconciler) Logger() logr.Logger

func (*BaseReconciler) Reconcile

func (*BaseReconciler) ReconcileResource

func (b *BaseReconciler) ReconcileResource(ctx context.Context, obj, desired client.Object, mutateFn MutateFn) error

ReconcileResource attempts to mutate the existing state in order to match the desired state. The object's desired state must be reconciled with the existing state inside the passed in callback MutateFn.

obj: Object of the same type as the 'desired' object.

Used to read the resource from the kubernetes cluster.
Could be zero-valued initialized object.

desired: Object representing the desired state

It returns an error.

func (*BaseReconciler) Scheme

func (b *BaseReconciler) Scheme() *runtime.Scheme

func (*BaseReconciler) SetOwnerReference

func (b *BaseReconciler) SetOwnerReference(owner, obj client.Object) error

SetOwnerReference sets owner as a Controller OwnerReference on owned

func (*BaseReconciler) UpdateResource

func (b *BaseReconciler) UpdateResource(ctx context.Context, obj client.Object) error

func (*BaseReconciler) UpdateResourceStatus

func (b *BaseReconciler) UpdateResourceStatus(ctx context.Context, obj client.Object) error

type MutateFn

type MutateFn func(existing, desired client.Object) (bool, error)

MutateFn is a function which mutates the existing object into it's desired state.

Jump to

Keyboard shortcuts

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