controllers

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultInitialBackoff = 10 * time.Second
	DefaultMaxBackoff     = 300 * time.Second
)
View Source
const (
	// This label is set on all dynamic objects to limit caches.
	DynamicCacheLabel = "package-operator.run/cache"
	// Common finalizer to free allocated caches when objects are deleted.
	CachedFinalizer = "package-operator.run/cached"
	// Records cause of change for history keeping.
	ChangeCauseAnnotation = "kubernetes.io/change-cause"
	// Causes PKO to skip ownership checks, used during self-bootstrap.
	ForceAdoptionEnvironmentVariable = "PKO_FORCE_ADOPTION"
)

Variables

This section is empty.

Functions

func AddDynamicCacheLabel added in v1.5.0

func AddDynamicCacheLabel(ctx context.Context, w client.Writer, obj *unstructured.Unstructured) (*unstructured.Unstructured, error)

AddDynamicCacheLabel ensures that the given object is labeled for recognition by the dynamic cache.

func DeleteMappedConditions added in v1.3.0

func DeleteMappedConditions(_ context.Context, conditions *[]metav1.Condition)

func EnsureCachedFinalizer

func EnsureCachedFinalizer(
	ctx context.Context, c client.Client, obj client.Object,
) error

func EnsureFinalizer

func EnsureFinalizer(
	ctx context.Context, c client.Client,
	obj client.Object, finalizer string,
) error

Ensures the given finalizer is set and persisted on the given object.

func FreeCacheAndRemoveFinalizer

func FreeCacheAndRemoveFinalizer(
	ctx context.Context, c client.Client,
	obj client.Object, cache cacheFreer,
) error

Frees caches and removes the associated finalizer.

func GetControllerOf

func GetControllerOf(
	_ context.Context, scheme *runtime.Scheme, ownerStrategy isControllerChecker,
	owner client.Object, actualObjects []client.Object,
) ([]corev1alpha1.ControlledObjectReference, error)

Returns a list of ControlledObjectReferences controlled by this instance.

func IsExternalResourceNotFound added in v1.6.1

func IsExternalResourceNotFound(err error) bool

func IsMappedCondition added in v1.3.0

func IsMappedCondition(cond metav1.Condition) bool

func MapConditions added in v1.3.0

func MapConditions(
	_ context.Context,
	srcGeneration int64, srcConditions []metav1.Condition,
	destGeneration int64, destConditions *[]metav1.Condition,
)

func RemoveFinalizer

func RemoveFinalizer(
	ctx context.Context, c client.Client,
	obj client.Object, finalizer string,
) error

Removes the given finalizer and persists the change.

Types

type BackoffConfig added in v1.6.1

type BackoffConfig struct {
	InitialBackoff *time.Duration
	MaxBackoff     *time.Duration
}

func (*BackoffConfig) Default added in v1.6.1

func (c *BackoffConfig) Default()

func (*BackoffConfig) GetBackoff added in v1.6.1

func (c *BackoffConfig) GetBackoff() *flowcontrol.Backoff

func (*BackoffConfig) Option added in v1.6.1

func (c *BackoffConfig) Option(opts ...BackoffOption)

type BackoffOption added in v1.6.1

type BackoffOption interface {
	ConfigureBackoff(*BackoffConfig)
}

type CommonObjectPhaseError

type CommonObjectPhaseError struct {
	OwnerKey, ObjectKey client.ObjectKey
	OwnerGVK, ObjectGVK schema.GroupVersionKind
}

type ControllerError added in v1.6.1

type ControllerError interface {
	CausedBy(reason ErrorReason) bool
}

type ErrorReason added in v1.6.1

type ErrorReason string
const (
	ErrorReasonExternalResourceNotFound ErrorReason = "external resource not found"
)

func (ErrorReason) String added in v1.6.1

func (r ErrorReason) String() string

type ObjectNotOwnedByPreviousRevisionError

type ObjectNotOwnedByPreviousRevisionError struct {
	CommonObjectPhaseError
}

This error is returned when a Phase contains objects that are not owned by a previous revision. Previous revisions of an Phase have to be declared in .spec.previousRevisions.

func (ObjectNotOwnedByPreviousRevisionError) Error

type PhaseObjectOwner

type PhaseObjectOwner interface {
	ClientObject() client.Object
	GetRevision() int64
	GetConditions() *[]metav1.Condition
	IsPaused() bool
}

type PhaseReconciler

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

PhaseReconciler reconciles objects within a ObjectSet phase.

func NewPhaseReconciler

func NewPhaseReconciler(
	scheme *runtime.Scheme,
	writer client.Writer,
	dynamicCache dynamicCache,
	uncachedClient client.Reader,
	ownerStrategy ownerStrategy,
	preflightChecker preflightChecker,
) *PhaseReconciler

func (*PhaseReconciler) ReconcilePhase

func (r *PhaseReconciler) ReconcilePhase(
	ctx context.Context, owner PhaseObjectOwner,
	phase corev1alpha1.ObjectSetTemplatePhase,
	probe probing.Prober, previous []PreviousObjectSet,
) (actualObjects []client.Object, res ProbingResult, err error)

func (*PhaseReconciler) TeardownPhase

func (r *PhaseReconciler) TeardownPhase(
	ctx context.Context, owner PhaseObjectOwner,
	phase corev1alpha1.ObjectSetTemplatePhase,
) (cleanupDone bool, err error)

type PhaseReconcilerError added in v1.6.1

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

func NewExternalResourceNotFoundError added in v1.6.1

func NewExternalResourceNotFoundError(rsrc client.Object) *PhaseReconcilerError

func (*PhaseReconcilerError) CausedBy added in v1.6.1

func (e *PhaseReconcilerError) CausedBy(reason ErrorReason) bool

func (*PhaseReconcilerError) Error added in v1.6.1

func (e *PhaseReconcilerError) Error() string

type PreviousObjectSet

type PreviousObjectSet interface {
	ClientObject() client.Object
	GetRemotePhases() []corev1alpha1.RemotePhaseReference
}

type PreviousObjectSetFactory

type PreviousObjectSetFactory func(*runtime.Scheme) PreviousObjectSet

type PreviousOwner

type PreviousOwner interface {
	ClientObject() client.Object
	GetPrevious() []corev1alpha1.PreviousRevisionReference
}

type PreviousRevisionLookup

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

func NewPreviousRevisionLookup

func NewPreviousRevisionLookup(
	scheme *runtime.Scheme,
	newPreviousObjectSet PreviousObjectSetFactory,
	client client.Reader,
) *PreviousRevisionLookup

func (*PreviousRevisionLookup) Lookup

type ProbingResult

type ProbingResult struct {
	PhaseName    string
	FailedProbes []string
}

func (*ProbingResult) IsZero

func (e *ProbingResult) IsZero() bool

func (*ProbingResult) String

func (e *ProbingResult) String() string

func (*ProbingResult) StringWithoutPhase

func (e *ProbingResult) StringWithoutPhase() string

type RevisionCollisionError

type RevisionCollisionError struct {
	CommonObjectPhaseError
}

This error is returned when a Phase tries to adopt an object where the revision number is not increasing.

func (RevisionCollisionError) Error

func (e RevisionCollisionError) Error() string

type WithInitialBackoff added in v1.6.1

type WithInitialBackoff time.Duration

func (WithInitialBackoff) ConfigureBackoff added in v1.6.1

func (w WithInitialBackoff) ConfigureBackoff(c *BackoffConfig)

type WithMaxBackoff added in v1.6.1

type WithMaxBackoff time.Duration

func (WithMaxBackoff) ConfigureBackoff added in v1.6.1

func (w WithMaxBackoff) ConfigureBackoff(c *BackoffConfig)

Directories

Path Synopsis
hypershift/v1beta1
The package v1beta1 contains some API Schema definitions for the v1beta1 version of some Hypershift API group.
The package v1beta1 contains some API Schema definitions for the v1beta1 version of some Hypershift API group.

Jump to

Keyboard shortcuts

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