machineops

package
v0.1.23-rc.6 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeginFunc

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

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

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

type ExecuteFunc

ExecuteFunc executes an immediate provider operation.

type Operation

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

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

func (*Operation) Begin

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

Begin invokes the registered long-running operation begin callback.

func (*Operation) Cleanup

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

Cleanup invokes the operation's optional cleanup callback.

func (*Operation) Execute

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

Execute invokes the registered immediate operation callback.

func (*Operation) Mode

func (o *Operation) Mode() OperationMode

Mode returns the lifecycle strategy used for the operation.

func (*Operation) Poll

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

func (o *Operation) ReplaySafe() bool

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

func (*Operation) RequiresReplaceUserData

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

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

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

OperationOption configures one registered operation.

func ReplaySafe

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

func RequiresReplaceUserData() OperationOption

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

func WithCleanup

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
	OperationName   string
	OperationUID    types.UID
	ProviderID      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

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

func (e *PermanentError) Error() string

func (*PermanentError) Unwrap

func (e *PermanentError) Unwrap() error

type PollFunc

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

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

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.provider.

func (*Provider) Operation

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

Operation returns the lifecycle strategy registered for kind.

type ProviderOperation

type ProviderOperation struct {
	OperationID string
	ResumeToken string
}

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

type ProviderOperationState

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

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

ProviderOption configures a Provider registration.

func WithImmediateOperation

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

WithImmediateOperation registers an operation executed by one callback.

func WithLongRunningOperation

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

WithLongRunningOperation registers an operation executed as begin and poll callbacks.

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