controllers

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Except

func Except[O client.Object](sets []O, except ...O) []O

func GetOwnedResources

func GetOwnedResources[O client.ObjectList, E metav1.Object](ctx context.Context, c client.Client, selector map[string]string, owner metav1.Object, list O, getter ItemGetter[O, E]) (owned []E, orphaned []E, err error)

func MaxRevisionOf

func MaxRevisionOf(sets []*v2.FirewallSet) (*v2.FirewallSet, error)

MaxRevisionOf finds the highest revision in the firewall sets

func MinRevisionOf

func MinRevisionOf(sets []*v2.FirewallSet) (*v2.FirewallSet, error)

MinRevisionOf finds the lowest revision in the firewall sets

func NewLogger added in v0.3.3

func NewLogger(levelString string) (slog.Handler, error)

func NextRevision

func NextRevision(o runtime.Object) (int, error)

func RequeueAfter

func RequeueAfter(d time.Duration, reason string) error

func Revision

func Revision(obj runtime.Object) (int, error)

Revision returns the revision number of the input object.

func SkipOtherNamespace

func SkipOtherNamespace(namespace string) func(object client.Object) bool

Types

type Ctx

type Ctx[O client.Object] struct {
	Ctx               context.Context
	Log               logr.Logger
	Target            O
	WithinMaintenance bool
}

type GenericController

type GenericController[O client.Object] struct {
	// contains filtered or unexported fields
}

func NewGenericController

func NewGenericController[O client.Object](l logr.Logger, c client.Client, namespace string, reconciler Reconciler[O]) *GenericController[O]

func (GenericController[O]) Reconcile

func (g GenericController[O]) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*GenericController[O]) WithoutStatus

func (g *GenericController[O]) WithoutStatus() *GenericController[O]

type ItemGetter

type ItemGetter[O client.ObjectList, E metav1.Object] func(O) []E

type Reconciler

type Reconciler[O client.Object] interface {
	// New returns a new object of O.
	New() O
	// SetStatus sets the status of the reconciled object into the refetched object. this mitigates status updates error due to concurrent modification.
	SetStatus(reconciled O, refetched O)
	Reconcile(rctx *Ctx[O]) error
	Delete(rctx *Ctx[O]) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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