provision

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package provision defines the interface for the infra provisioner.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRetryError

func NewRetryError(err error, interval time.Duration) error

NewRetryError should be returned from the provisioner when it hits the retryable error.

func NewRetryErrorf

func NewRetryErrorf(interval time.Duration, format string, args ...any) error

NewRetryErrorf should be returned from the provisioner when it hits the retryable error.

func NewRetryInterval added in v0.45.0

func NewRetryInterval(interval time.Duration) error

NewRetryInterval should be returned from the provisioner when it should be called after some interval again.

Types

type ConnectionParams added in v0.45.0

type ConnectionParams struct {
	JoinConfig string
	KernelArgs []string

	CustomDataEncoded bool
}

ConnectionParams represents kernel params and join config for making the machine join Omni.

type Context

type Context[T resource.Resource] struct {
	MachineRequestStatus *infra.MachineRequestStatus

	State            T
	ConnectionParams ConnectionParams
	// contains filtered or unexported fields
}

Context keeps all context which might be required for the provision calls.

func NewContext

func NewContext[T resource.Resource](
	machineRequest *infra.MachineRequest,
	machineRequestStatus *infra.MachineRequestStatus,
	state T,
	connectionParams ConnectionParams,
	imageFactory FactoryClient,
	runtime controller.QRuntime,
) Context[T]

NewContext creates a new provision context.

func (*Context[T]) CreateConfigPatch added in v0.45.0

func (context *Context[T]) CreateConfigPatch(ctx context.Context, name string, data []byte) error

CreateConfigPatch for the provisioned machine.

func (*Context[T]) GenerateSchematicID

func (context *Context[T]) GenerateSchematicID(ctx context.Context, logger *zap.Logger, opts ...SchematicOption) (string, error)

GenerateSchematicID generate the final schematic out of the machine request. This method also calls the image factory and uploads the schematic there.

func (*Context[T]) GetRequestID

func (context *Context[T]) GetRequestID() string

GetRequestID returns machine request id.

func (*Context[T]) GetTalosVersion

func (context *Context[T]) GetTalosVersion() string

GetTalosVersion returns Talos version from the machine request.

func (*Context[T]) SetMachineInfraID

func (context *Context[T]) SetMachineInfraID(value string)

SetMachineInfraID in the machine request status.

func (*Context[T]) SetMachineUUID

func (context *Context[T]) SetMachineUUID(value string)

SetMachineUUID in the machine request status.

func (*Context[T]) UnmarshalProviderData added in v0.45.0

func (context *Context[T]) UnmarshalProviderData(dest any) error

UnmarshalProviderData reads provider data string from the machine request into the dest.

type FactoryClient

type FactoryClient interface {
	EnsureSchematic(context.Context, schematic.Schematic) (string, error)
}

FactoryClient ensures that the given schematic exists in the image factory.

type Provisioner

type Provisioner[T resource.Resource] interface {
	ProvisionSteps() []Step[T]
	Deprovision(context.Context, *zap.Logger, T, *infra.MachineRequest) error
}

Provisioner is the interface that should be implemented by an infra provider.

type SchematicOption

type SchematicOption func(*SchematicOptions)

SchematicOption is the optional argument to the GetSchematicID method.

func WithExtraExtensions

func WithExtraExtensions(extensions ...string) SchematicOption

WithExtraExtensions adds more extensions to the schematic. The provider can detect the hardware and install some extensions automatically using this method.

func WithExtraKernelArgs

func WithExtraKernelArgs(args ...string) SchematicOption

WithExtraKernelArgs adds kernel args to the schematic. This method doesn't remove duplicate kernel arguments.

func WithMetaValues

func WithMetaValues(values ...schematic.MetaValue) SchematicOption

WithMetaValues adds meta values to the generated schematic. If the meta values with the same names are already set they are overwritten.

func WithOverlay

func WithOverlay(overlay schematic.Overlay) SchematicOption

WithOverlay sets the overlay on the schematic.

func WithoutConnectionParams

func WithoutConnectionParams() SchematicOption

WithoutConnectionParams generates the schematic without embedding connection params into the kernel args. This flag might be useful for providers which use PXE to boot the machines, so the schematics won't need the parameters for Omni connection. This can allow to minimize the amount of schematics needed to be generated for the provider.

type SchematicOptions

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

SchematicOptions is used during schematic ID generation.

type Step

type Step[T resource.Resource] struct {
	// contains filtered or unexported fields
}

Step implements a single provision step.

func NewStep

func NewStep[T resource.Resource](name string, run func(context.Context, *zap.Logger, Context[T]) error) Step[T]

NewStep creates a new provision step.

func (Step[T]) Name

func (s Step[T]) Name() string

Name of the step.

func (Step[T]) Run

func (s Step[T]) Run(ctx context.Context, logger *zap.Logger, provisionContext Context[T]) error

Run the step.

Jump to

Keyboard shortcuts

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