controllers

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 60 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeReadyCondition added in v0.5.0

func ComputeReadyCondition(generation int64, probeErr error) computev1alpha1.MachinePoolCondition

ComputeReadyCondition returns the MachinePoolCondition that reflects the result of the most recent IRI Status probe for the given pool generation.

func FindNewIRINetworkInterfaces

func FindNewIRINetworkInterfaces(desiredIRINics, existingIRINics []*iri.NetworkInterface) []*iri.NetworkInterface

func FindNewIRIVolumes

func FindNewIRIVolumes(desiredIRIVolumes, existingIRIVolumes []*iri.Volume) []*iri.Volume

func MachineRunsInMachinePool

func MachineRunsInMachinePool(machine *computev1alpha1.Machine, machinePoolName string) bool

func MachineRunsInMachinePoolPredicate

func MachineRunsInMachinePoolPredicate(machinePoolName string) predicate.Predicate

func ReadyConditionsDiffer added in v0.5.0

func ReadyConditionsDiffer(existing *computev1alpha1.MachinePoolCondition, desired computev1alpha1.MachinePoolCondition) bool

ReadyConditionsDiffer reports whether existing differs from desired in any field that justifies a status patch. LastUpdateTime and LastTransitionTime are intentionally ignored — they are bookkeeping that should only advance when something else also advances. A nil existing always differs.

Types

type MachineAnnotatorReconciler

type MachineAnnotatorReconciler struct {
	client.Client

	MachineEvents irievent.Source[*iri.Machine]
}

func (*MachineAnnotatorReconciler) Reconcile

func (*MachineAnnotatorReconciler) SetupWithManager

func (r *MachineAnnotatorReconciler) SetupWithManager(mgr ctrl.Manager) error

type MachinePoolAnnotatorReconciler

type MachinePoolAnnotatorReconciler struct {
	client.Client

	MachinePoolName    string
	MachineClassMapper mcm.MachineClassMapper
}

func (*MachinePoolAnnotatorReconciler) Reconcile

func (*MachinePoolAnnotatorReconciler) SetupWithManager

func (r *MachinePoolAnnotatorReconciler) SetupWithManager(mgr ctrl.Manager) error

type MachinePoolHeartbeat added in v0.5.0

type MachinePoolHeartbeat struct {
	Client          client.Client
	MachinePoolName string
	MachineRuntime  machine.RuntimeService

	// ReadyState receives the latest probe result on every tick.
	ReadyState *MachinePoolReadyState

	// Events is owned by the caller. The heartbeat sends a single
	// GenericEvent for the pool whenever the probe result changes, so the
	// MachinePoolReconciler picks up the change without waiting for an
	// unrelated reconcile trigger. May be nil in tests where no reconciler
	// consumes the events.
	Events chan<- event.GenericEvent

	HeartbeatInterval  time.Duration
	LeaseDuration      time.Duration
	StatusProbeTimeout time.Duration
	// contains filtered or unexported fields
}

MachinePoolHeartbeat is a manager.Runnable that periodically renews the pool's Lease in NamespaceMachinePoolLease and publishes the latest IRI Status probe result into a shared MachinePoolReadyState. When the probe result changes (or on the first tick), it sends a generic event on Events so the MachinePoolReconciler — the actual writer of the pool's Status — reconciles the new condition.

func NewMachinePoolHeartbeat added in v0.5.0

func NewMachinePoolHeartbeat(
	c client.Client,
	machinePoolName string,
	machineRuntime machine.RuntimeService,
	readyState *MachinePoolReadyState,
	events chan<- event.GenericEvent,
	heartbeatInterval, leaseDuration, statusProbeTimeout time.Duration,
) *MachinePoolHeartbeat

NewMachinePoolHeartbeat constructs a heartbeat runnable. The holderIdentity is fixed for the process lifetime: <poolName>_<uuid>.

func (*MachinePoolHeartbeat) Start added in v0.5.0

func (h *MachinePoolHeartbeat) Start(ctx context.Context) error

Start runs the heartbeat loop until ctx is canceled. It satisfies sigs.k8s.io/controller-runtime/pkg/manager.Runnable.

type MachinePoolInit

type MachinePoolInit struct {
	client.Client

	MachinePoolName string
	ProviderID      string

	TopologyLabels map[commonv1alpha1.TopologyLabel]string

	OnInitialized func(ctx context.Context) error
	OnFailed      func(ctx context.Context, reason error) error
}

func (*MachinePoolInit) SetupWithManager

func (i *MachinePoolInit) SetupWithManager(mgr ctrl.Manager) error

func (*MachinePoolInit) Start

func (i *MachinePoolInit) Start(ctx context.Context) error

type MachinePoolReadyState added in v0.5.0

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

MachinePoolReadyState is a thread-safe holder of the most recent IRI Status probe result. The MachinePoolHeartbeat publishes results into it; the MachinePoolReconciler reads them when computing the Ready condition.

hasResult is false until the first tick has run, which lets the reconciler avoid clobbering whatever value is currently on the pool (e.g. a Ready=Unknown set by the lifecycle controller) before the poollet has any opinion of its own.

func NewMachinePoolReadyState added in v0.5.0

func NewMachinePoolReadyState() *MachinePoolReadyState

NewMachinePoolReadyState returns a fresh, empty state.

func (*MachinePoolReadyState) Get added in v0.5.0

func (s *MachinePoolReadyState) Get() (probeErr error, hasResult bool)

Get returns the latest probe result and whether any tick has stored one.

func (*MachinePoolReadyState) Set added in v0.5.0

func (s *MachinePoolReadyState) Set(probeErr error) (changed bool)

Set stores the latest probe result and reports whether it differs from the previously stored value. The very first call always reports changed=true. Two errors are considered equal if their Error() strings match — that is what feeds into the condition's Message field.

type MachinePoolReconciler

type MachinePoolReconciler struct {
	client.Client

	// MachinePoolName is the name of the computev1alpha1.MachinePool to report / update.
	MachinePoolName string
	// Addresses are the addresses the machinepoollet server is available on.
	Addresses []computev1alpha1.MachinePoolAddress
	// Port is the port the machinepoollet server is available on.
	Port int32

	MachineRuntime     machine.RuntimeService
	MachineClassMapper mcm.MachineClassMapper

	TopologyLabels map[commonv1alpha1.TopologyLabel]string

	// ReadyState carries the latest IRI Status probe result published by the
	// MachinePoolHeartbeat. When non-nil and populated, the reconciler
	// reflects it into Status.Conditions[Ready] as part of its single status
	// patch. The reconciler is the only poollet-side writer of that
	// condition. May be nil; in that case the condition is left untouched.
	ReadyState *MachinePoolReadyState

	// HeartbeatEvents is an optional channel that the heartbeat uses to
	// nudge this reconciler when ReadyState changes. SetupWithManager wires
	// it as a source.Channel. May be nil.
	HeartbeatEvents <-chan event.GenericEvent
}

func (*MachinePoolReconciler) Reconcile

func (r *MachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*MachinePoolReconciler) SetupWithManager

func (r *MachinePoolReconciler) SetupWithManager(mgr ctrl.Manager) error

type MachineReconciler

type MachineReconciler struct {
	events.EventRecorder
	client.Client

	MachineRuntime        irimachine.RuntimeService
	MachineRuntimeName    string
	MachineRuntimeVersion string

	MachineClassMapper mcm.MachineClassMapper

	MachinePoolName string

	MachineDownwardAPILabels      map[string]string
	MachineDownwardAPIAnnotations map[string]string

	NicDownwardAPILabels      map[string]string
	NicDownwardAPIAnnotations map[string]string

	VolumeDownwardAPILabels      map[string]string
	VolumeDownwardAPIAnnotations map[string]string

	NetworkDownwardAPILabels      map[string]string
	NetworkDownwardAPIAnnotations map[string]string

	WatchFilterValue string

	MaxConcurrentReconciles int
}

func (*MachineReconciler) Reconcile

func (r *MachineReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*MachineReconciler) SetupWithManager

func (r *MachineReconciler) SetupWithManager(mgr ctrl.Manager) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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