machineops

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultClassRefreshInterval is how long the MachineClass controller
	// waits before resolving a class again when no offering expires sooner,
	// and after an input failure.
	DefaultClassRefreshInterval = 5 * time.Minute

	// DefaultClassMinRequeueInterval is the shortest requeue after a class
	// resolved successfully.
	DefaultClassMinRequeueInterval = 10 * time.Second

	// ClassMinRequeueIntervalLowerBound is the smallest accepted minimum
	// requeue interval.
	ClassMinRequeueIntervalLowerBound = time.Second
)
View Source
const MaxConditionMessageBytes = 32768

MaxConditionMessageBytes is the longest metav1.Condition message the API server accepts. Every writer of a condition message truncates to it.

View Source
const (
	OperationConditionCompleted = "Completed"
)

Variables

This section is empty.

Functions

func TruncateUTF8Bytes added in v0.23.0

func TruncateUTF8Bytes(value string, maxBytes int) string

TruncateUTF8Bytes returns value cut to at most maxBytes bytes without splitting a UTF-8 sequence.

Types

type ClusterInfo

type ClusterInfo struct {
	APIServer      string
	CACertBase64   string
	ClusterDNS     string
	KubeVersion    string
	ProviderLabels map[string]string
}

ClusterInfo holds the cluster-level data needed to build host replacement cloud-init.

func ResolveClusterInfo

func ResolveClusterInfo(ctx context.Context, apiServerEndpoint string, k kubernetes.Interface) (*ClusterInfo, error)

ResolveClusterInfo resolves cluster bootstrap details for HostReplace.

type MachineAllocationReconciler added in v0.24.0

type MachineAllocationReconciler struct {
	// Client reads MachineAllocations, MachineClasses, Sites,
	// MachineConfigurationVersions, Machines, MachineOperations, Nodes and
	// consumer metadata from the manager cache, and makes every write.
	client.Client
	// ConfigMapReader reads provider-config and bootstrap files ConfigMaps.
	ConfigMapReader client.Reader
	// APIReader reads bootstrap token Secrets and confirms what the cache
	// reports missing or replaced.
	APIReader client.Reader
	Providers []*Provider
	SiteName  string
	// ConsumerKinds are the cluster-scoped consumer kinds whose termination
	// and loss retire an allocation.
	ConsumerKinds []schema.GroupVersionKind
	Now           func() time.Time
}

MachineAllocationReconciler launches one host for each MachineAllocation of a provider that declares capacity, through a Machine and a HostAllocate MachineOperation, fences it when the allocation retires, and releases it through a HostRelease MachineOperation once the consumer sets lifecycle Released.

func (*MachineAllocationReconciler) Reconcile added in v0.24.0

func (*MachineAllocationReconciler) SetupWithManager added in v0.24.0

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

SetupWithManager registers the controller with mgr.

type MachineClassReconciler added in v0.24.0

type MachineClassReconciler struct {
	// Client reads MachineClasses, Sites, MachineConfigurationVersions and
	// MachineOperationCredentials, and writes MachineClass status.
	client.Client
	// ConfigMapReader reads provider-config and bootstrap files ConfigMaps.
	ConfigMapReader client.Reader
	// SecretReader reads credential Secrets.
	SecretReader              client.Reader
	Providers                 []*Provider
	SiteName                  string
	CredentialSecretNamespace string
	ProviderConfigNamespace   string
	ClassRefreshInterval      time.Duration
	MinRequeueInterval        time.Duration
	Now                       func() time.Time
}

MachineClassReconciler resolves the inputs of MachineClasses whose provider declares capacity and publishes them, with the provider's offerings, in the class status.

func (*MachineClassReconciler) Reconcile added in v0.24.0

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

func (*MachineClassReconciler) SetupWithManager added in v0.24.0

func (r *MachineClassReconciler) SetupWithManager(mgr ctrl.Manager, configMaps cache.Cache) error

SetupWithManager registers the controller with mgr. ConfigMaps are watched through configMaps, the cache that ConfigMapReader reads from.

type MachineOperationReconciler

type MachineOperationReconciler struct {
	client.Client
	RESTMapper                  apimeta.RESTMapper
	Providers                   []*Provider
	SiteName                    string
	ProviderName                string
	MaxConcurrentReconciles     int
	ProviderPollInterval        time.Duration
	ProviderStallAfter          time.Duration
	ProviderStalledPollInterval time.Duration
	Now                         func() metav1.Time
	ClusterInfo                 *ClusterInfo
	KubeClient                  kubernetes.Interface
	APIServerEndpoint           string
	CredentialSecretNamespace   string

	// ExperimentalContainerIsolation enables the experimental container
	// isolation mode for HostReplace: the replacement's agent configuration
	// opts in (Experimental.ContainerIsolation). When it is not set, a
	// HostReplace of a Machine that declares container fails before the
	// provider runs.
	ExperimentalContainerIsolation bool
}

MachineOperationReconciler reconciles MachineOperation objects that target externally controlled machines.

func (*MachineOperationReconciler) Reconcile

func (*MachineOperationReconciler) ReconcileAllocationOperation added in v0.24.0

func (r *MachineOperationReconciler) ReconcileAllocationOperation(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

ReconcileAllocationOperation runs the HostAllocate and HostRelease operations of Machines bound to a MachineAllocation. It is the only code that calls a provider's HostAllocate or HostRelease callbacks.

func (*MachineOperationReconciler) SetupAllocationWithManager added in v0.24.0

func (r *MachineOperationReconciler) SetupAllocationWithManager(mgr ctrl.Manager) error

SetupAllocationWithManager registers the controller that runs HostAllocate and HostRelease operations with mgr.

func (*MachineOperationReconciler) SetupWithManager

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

type OperationAuth added in v0.1.8

type OperationAuth = publicmachineops.OperationAuth

OperationAuth is the provider-facing credential material resolved for an operation.

type OperationRequest

type OperationRequest = publicmachineops.OperationRequest

OperationRequest is the generic provider-facing view of a MachineOperation.

type OperationResult added in v0.1.6

type OperationResult = publicmachineops.OperationResult

OperationResult describes provider-side changes that must be reflected after execution.

type Provider

type Provider = publicmachineops.Provider

Provider registers MachineOperation lifecycle strategies for one external provider.

Directories

Path Synopsis
providers

Jump to

Keyboard shortcuts

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