controller

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceAccountCleanupFinalizer = "octopus.com/serviceaccount-cleanup"
	ManagedByLabel                 = "octopus.com/managed-by"
	ManagedByValue                 = "permissions-controller"

	ReasonReconcileSuccess = "ReconcileSuccess"
	ReasonReconcileFailed  = "ReconcileFailed"
)

Variables

This section is empty.

Functions

func CWSAStatusNeedsUpdate added in v1.0.0

func CWSAStatusNeedsUpdate(current, desired *agentoctopuscomv1beta1.ClusterWorkloadServiceAccountStatus) bool

CWSAStatusNeedsUpdate determines if a ClusterWorkloadServiceAccount status update is needed. It returns true if the conditions have meaningfully changed.

func ConditionsEqual added in v1.0.0

func ConditionsEqual(a, b []metav1.Condition) bool

ConditionsEqual compares two condition slices for equality in an order-insensitive manner. It returns true if both slices contain the same conditions with matching Type, Status, and Reason. Message and LastTransitionTime are intentionally not compared to avoid spurious updates.

func ExternalChangePredicate added in v1.0.0

func ExternalChangePredicate() predicate.Predicate

ExternalChangePredicate filters out Create/Update events caused by this controller's Server-Side Apply operations by checking the ManagedFields metadata.

func ExternalDeletePredicate added in v1.0.0

func ExternalDeletePredicate(tracker GCTrackerInterface) predicate.Predicate

ExternalDeletePredicate filters out Delete events for resources being actively garbage collected by this controller.

func GenerationOrDeletePredicate added in v1.0.0

func GenerationOrDeletePredicate() predicate.Predicate

func IsManagedServiceAccount

func IsManagedServiceAccount(obj interface{}) bool

func ManagedResourcePredicate added in v1.0.0

func ManagedResourcePredicate() predicate.Predicate

func ManagedServiceAccountPredicate added in v1.0.0

func ManagedServiceAccountPredicate() predicate.Predicate

func MapServiceAccountToResources

func MapServiceAccountToResources[T client.Object, L client.ObjectList](
	ctx context.Context,
	obj client.Object,
	c client.Client,
	listObj L,
	extractItems func(L) []T,
	resourceType string,
) []reconcile.Request

func SuppressOwnedResourceDeletes

func SuppressOwnedResourceDeletes() predicate.Predicate

func WSAStatusNeedsUpdate added in v1.0.0

func WSAStatusNeedsUpdate(current, desired *agentoctopuscomv1beta1.WorkloadServiceAccountStatus) bool

WSAStatusNeedsUpdate determines if a WorkloadServiceAccount status update is needed. It returns true if the conditions have meaningfully changed.

Types

type ClusterWorkloadServiceAccountReconciler

type ClusterWorkloadServiceAccountReconciler struct {
	client.Client
	Scheme         *runtime.Scheme
	Engine         *rules.InMemoryEngine
	EventCollector *staging.EventCollector
	Recorder       record.EventRecorder
}

func (*ClusterWorkloadServiceAccountReconciler) Reconcile

func (*ClusterWorkloadServiceAccountReconciler) SetupWithManager

func (r *ClusterWorkloadServiceAccountReconciler) SetupWithManager(mgr ctrl.Manager, gcTracker *GCTracker) error

type GCTracker added in v1.0.0

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

GCTracker tracks resources being actively garbage collected by the controller. It uses an expirable LRU cache to automatically clean up entries after a TTL.

func NewGCTracker added in v1.0.0

func NewGCTracker(ttl time.Duration) *GCTracker

NewGCTracker creates a new GCTracker with the specified TTL for entries. The TTL should be long enough to cover the delay between the delete call and the watch event being processed by the predicate.

func (*GCTracker) IsBeingDeleted added in v1.0.0

func (t *GCTracker) IsBeingDeleted(uid types.UID) bool

IsBeingDeleted returns true if the resource with the given UID is being actively deleted by the controller (was recently marked for deletion and hasn't expired).

func (*GCTracker) MarkForDeletion added in v1.0.0

func (t *GCTracker) MarkForDeletion(uid types.UID)

MarkForDeletion records that a resource with the given UID is being deleted by the controller. This should be called immediately before the delete operation.

type GCTrackerInterface added in v1.0.0

type GCTrackerInterface interface {
	MarkForDeletion(uid types.UID)
	IsBeingDeleted(uid types.UID) bool
}

GCTrackerInterface defines the interface for tracking resources being garbage collected. This allows predicates to filter out delete events for resources the controller is actively removing.

type WorkloadServiceAccountReconciler

type WorkloadServiceAccountReconciler struct {
	client.Client
	Scheme         *runtime.Scheme
	Engine         *rules.InMemoryEngine
	EventCollector *staging.EventCollector
	Recorder       record.EventRecorder
}

func (*WorkloadServiceAccountReconciler) Reconcile

func (*WorkloadServiceAccountReconciler) SetupWithManager

func (r *WorkloadServiceAccountReconciler) SetupWithManager(mgr ctrl.Manager, gcTracker *GCTracker) error

Jump to

Keyboard shortcuts

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