machineops

package
v0.1.24-rc.10 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeginFunc added in v0.1.23

type BeginFunc func(context.Context, OperationRequest) (BeginResult, error)

BeginFunc starts a long-running provider operation. It must be idempotent for a stable OperationRequest.OperationUID: repeated calls must return a usable handle for the same logical operation until that handle has been persisted.

type BeginResult added in v0.1.23

type BeginResult struct {
	Operation    ProviderOperation
	Message      string
	RequeueAfter time.Duration
}

BeginResult contains the durable handle returned by an idempotent Begin callback. The controller may invoke Begin again with the same OperationUID until a handle for the same logical operation has been persisted.

type CleanupFunc added in v0.1.23

CleanupFunc performs optional provider cleanup after an operation result has been applied to the Machine.

type ExecuteFunc added in v0.1.23

ExecuteFunc executes an immediate provider operation.

type Operation added in v0.1.23

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

Operation is an immutable lifecycle strategy registered for one operation kind.

func (*Operation) Begin added in v0.1.23

func (o *Operation) Begin(ctx context.Context, request OperationRequest) (BeginResult, error)

Begin invokes the registered long-running operation begin callback.

func (*Operation) Cleanup added in v0.1.23

func (o *Operation) Cleanup(ctx context.Context, request OperationRequest, result OperationResult) error

Cleanup invokes the operation's optional cleanup callback.

func (*Operation) Execute added in v0.1.23

func (o *Operation) Execute(ctx context.Context, request OperationRequest) (OperationResult, error)

Execute invokes the registered immediate operation callback.

func (*Operation) Mode added in v0.1.23

func (o *Operation) Mode() OperationMode

Mode returns the lifecycle strategy used for the operation.

func (*Operation) Poll added in v0.1.23

func (o *Operation) Poll(ctx context.Context, request OperationRequest, operation ProviderOperation) (PollResult, error)

Poll invokes the registered long-running operation poll callback.

func (*Operation) ReplaySafe added in v0.1.23

func (o *Operation) ReplaySafe() bool

ReplaySafe reports whether an immediate operation may be executed again after reconciliation resumes from InProgress.

func (*Operation) RequiresReplaceUserData added in v0.1.23

func (o *Operation) RequiresReplaceUserData() bool

RequiresReplaceUserData reports whether replacement bootstrap data is needed.

type OperationAuth

type OperationAuth struct {
	Mode       unboundedv1alpha3.MachineOperationCredentialAuthMode
	SecretData map[string]string
}

OperationAuth is the provider-facing credential material resolved for an operation. Provider packages own the interpretation of SecretData.

func (*OperationAuth) RequiredSecretValue

func (a *OperationAuth) RequiredSecretValue(key string) (string, error)

RequiredSecretValue returns a non-empty provider-specific secret value.

type OperationMode added in v0.1.23

type OperationMode string

OperationMode identifies how the lifecycle controller executes an operation.

const (
	// OperationModeImmediate executes an operation in one provider callback.
	OperationModeImmediate OperationMode = "Immediate"

	// OperationModeLongRunning starts an operation and polls its persisted handle.
	OperationModeLongRunning OperationMode = "LongRunning"
)

type OperationOption added in v0.1.23

type OperationOption interface {
	// contains filtered or unexported methods
}

OperationOption configures one registered operation.

func ReplaySafe added in v0.1.23

func ReplaySafe() OperationOption

ReplaySafe declares that an immediate operation may be executed again when reconciliation resumes after its phase was persisted as InProgress.

func RequiresReplaceUserData added in v0.1.23

func RequiresReplaceUserData() OperationOption

RequiresReplaceUserData declares that the lifecycle controller must build host replacement bootstrap data before invoking the provider callback.

func WithCleanup added in v0.1.23

func WithCleanup(cleanup CleanupFunc) OperationOption

WithCleanup registers optional cleanup performed after the controller has applied the provider operation result.

type OperationRequest

type OperationRequest struct {
	MachineName       string
	MachineUID        types.UID
	MachineGeneration int64
	OperationName     string
	OperationUID      types.UID
	// ProviderRef snapshots Machine.spec.host.external.machineRef when present.
	ProviderRef *unboundedv1alpha3.ProviderMachineSnapshot
	// ProviderID is the current canonical or legacy provider-specific host ID.
	ProviderID      string
	HostImage       string
	Operation       unboundedv1alpha3.OperationKind
	Parameters      map[string]string
	ReplaceUserData string
	Auth            *OperationAuth
}

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

type OperationResult

type OperationResult struct {
	ProviderID        string
	CleanupProviderID string
}

OperationResult describes provider-side changes that must be reflected after execution, such as replacement of an underlying cloud resource identity.

type PermanentError added in v0.1.23

type PermanentError struct {
	Reason string
	Err    error
}

PermanentError reports that retrying a provider callback cannot make progress. Providers should return ordinary errors for transient failures.

func (*PermanentError) Error added in v0.1.23

func (e *PermanentError) Error() string

func (*PermanentError) Unwrap added in v0.1.23

func (e *PermanentError) Unwrap() error

type PollFunc added in v0.1.23

PollFunc observes a previously accepted long-running provider operation. Ordinary errors are retried with the same persisted handle. A PermanentError terminates the MachineOperation.

type PollResult added in v0.1.23

type PollResult struct {
	State        ProviderOperationState
	Result       OperationResult
	Reason       string
	Message      string
	RequeueAfter time.Duration
}

PollResult describes one status observation for a resumable provider operation.

type Provider

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

Provider is an immutable registration of one provider's supported MachineOperation lifecycle strategies.

func NewProvider added in v0.1.23

func NewProvider(name string, options ...ProviderOption) (*Provider, error)

NewProvider validates and constructs an immutable provider registration.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the external provider name matched against Machine.spec.host.external.provider or a deprecated Machine.spec.provider.

func (*Provider) Operation added in v0.1.23

func (p *Provider) Operation(kind unboundedv1alpha3.OperationKind) (*Operation, bool)

Operation returns the lifecycle strategy registered for kind.

func (*Provider) ProviderMachineKind added in v0.1.23

func (p *Provider) ProviderMachineKind() (schema.GroupKind, bool)

ProviderMachineKind returns the provider-owned Machine GroupKind declared by this registration.

type ProviderOperation added in v0.1.23

type ProviderOperation struct {
	OperationID string
	ResumeToken string
}

ProviderOperation is the provider-neutral representation of a resumable external operation.

type ProviderOperationState added in v0.1.23

type ProviderOperationState string

ProviderOperationState is the provider-neutral lifecycle of a resumable operation.

const (
	ProviderOperationStateInProgress ProviderOperationState = "InProgress"
	ProviderOperationStateSucceeded  ProviderOperationState = "Succeeded"
	ProviderOperationStateFailed     ProviderOperationState = "Failed"
	ProviderOperationStateCanceled   ProviderOperationState = "Canceled"
)

type ProviderOption added in v0.1.23

type ProviderOption interface {
	// contains filtered or unexported methods
}

ProviderOption configures a Provider registration.

func WithImmediateOperation added in v0.1.23

func WithImmediateOperation(
	kind unboundedv1alpha3.OperationKind,
	execute ExecuteFunc,
	options ...OperationOption,
) ProviderOption

WithImmediateOperation registers an operation executed by one callback.

func WithLongRunningOperation added in v0.1.23

func WithLongRunningOperation(
	kind unboundedv1alpha3.OperationKind,
	begin BeginFunc,
	poll PollFunc,
	options ...OperationOption,
) ProviderOption

WithLongRunningOperation registers an operation executed as begin and poll callbacks.

func WithProviderMachineKind added in v0.1.23

func WithProviderMachineKind(groupKind schema.GroupKind) ProviderOption

WithProviderMachineKind declares the provider-owned Machine GroupKind accepted through Machine.spec.host.external.machineRef. Providers may also accept host.external.providerID or the deprecated Machine.spec.providerID.

Directories

Path Synopsis
Package controller registers the reusable MachineOperation provider controller with a controller-runtime manager.
Package controller registers the reusable MachineOperation provider controller with a controller-runtime manager.

Jump to

Keyboard shortcuts

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