object

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasComponentLabel

func HasComponentLabel() client.ListOption

Types

type ConvertFunc

type ConvertFunc func(list client.ObjectList) []juggler.Component

type DetectorContext

type DetectorContext struct {
	// FilterCriteria describes a list of Options which identify all objects which can
	// potentially become orphaned. This should exclude objects created by the end-user
	FilterCriteria FilterCriteria
	// ConvertFunc is a transformation-func which converts a list of orphaned objects
	// into a list of known juggler components
	ConvertFunc ConvertFunc
	// SameFunc is a comparison-func which allows to compare two juggler components
	SameFunc SameFunc
	// ListType describes the type the applied object should have inside the cluster
	ListType client.ObjectList
}

type FilterCriteria

type FilterCriteria []client.ListOption

type ObjectComponent

type ObjectComponent interface {
	juggler.Component

	// BuildObjectToReconcile returns an empty API object of the type that the ObjectComponent represents.
	// The object's desired state must be reconciled with the existing state inside the ReconcileObject(...) function.
	// It is called regardless of creating or updating an object.
	// Any information (also in `metadata`, e.g. labels) will be overridden before ReconcileObject(...) is called.
	BuildObjectToReconcile(ctx context.Context) (client.Object, types.NamespacedName, error)

	// ReconcileObject brings the client.Object closer to the desired state.
	ReconcileObject(ctx context.Context, obj client.Object) error

	// IsObjectHealthy returns if the object is healthy.
	IsObjectHealthy(obj client.Object) juggler.ResourceHealthiness
}

ObjectComponent is an interface for manageable components, specifically for plain client.Objects.

type ObjectReconciler

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

func NewReconciler

func NewReconciler(logger logr.Logger, remoteClient client.Client) *ObjectReconciler

func (*ObjectReconciler) DetectOrphanedComponents

func (r *ObjectReconciler) DetectOrphanedComponents(
	ctx context.Context,
	configuredComponents []juggler.Component,
) ([]juggler.Component, error)

DetectOrphanedComponents implements juggler.OrphanedComponentsDetector.

func (*ObjectReconciler) Install

func (r *ObjectReconciler) Install(ctx context.Context, component juggler.Component) error

Install implements ComponentReconciler.

func (*ObjectReconciler) KnownTypes

func (r *ObjectReconciler) KnownTypes() []reflect.Type

KnownTypes implements juggler.ComponentReconciler.

func (*ObjectReconciler) Observe

Observe implements ComponentReconciler.

func (*ObjectReconciler) PreInstall

func (r *ObjectReconciler) PreInstall(ctx context.Context, component juggler.Component) error

PreInstall implements juggler.ComponentReconciler.

func (*ObjectReconciler) PreUninstall

func (r *ObjectReconciler) PreUninstall(ctx context.Context, component juggler.Component) error

PreUninstall implements ComponentReconciler.

func (*ObjectReconciler) PreUpdate

func (r *ObjectReconciler) PreUpdate(ctx context.Context, component juggler.Component) error

PreUpdate implements juggler.ComponentReconciler.

func (*ObjectReconciler) RegisterType

func (r *ObjectReconciler) RegisterType(comps ...ObjectComponent)

func (*ObjectReconciler) Uninstall

func (r *ObjectReconciler) Uninstall(ctx context.Context, component juggler.Component) error

Uninstall implements ComponentReconciler.

func (*ObjectReconciler) Update

func (r *ObjectReconciler) Update(ctx context.Context, component juggler.Component) error

Update implements ComponentReconciler.

type OrphanedObjectsDetector

type OrphanedObjectsDetector interface {
	OrphanDetectorContext() DetectorContext
}

OrphanedObjectsDetector describes an interface for handling orphaned resources. It should be implemented by MCP components which can leave orphaned resources after said component is being removed from the MCP

type SameFunc

type SameFunc func(configured, detected juggler.Component) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳