infra

package
v1.5.9 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MPL-2.0 Imports: 20 Imported by: 5

Documentation

Overview

Package infra contains boilerplate code for the infra provider implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResourceNamespace

func ResourceNamespace(providerID string) string

ResourceNamespace generates the correct namespace name for the infra provider state.

func ResourceType

func ResourceType(name, providerID string) string

ResourceType generates the correct resource name for the resources managed by the infra providers.

Types

type HealthCheckFunc added in v0.46.0

type HealthCheckFunc func(context.Context) error

HealthCheckFunc defines a function that checks the health of the infra provider.

type Option

type Option func(*Options)

Option define an additional infra provider option.

func WithClientOptions

func WithClientOptions(options ...client.Option) Option

WithClientOptions defines custom options for the Omni API client.

func WithConcurrency

func WithConcurrency(value uint) Option

WithConcurrency sets maximum provision concurrency on the controller.

func WithEncodeRequestIDsIntoTokens added in v0.52.0

func WithEncodeRequestIDsIntoTokens() Option

WithEncodeRequestIDsIntoTokens enables encoding the request IDs into tokens. This eliminates the need for setting the node UUID on the MachineRequestStatus. Omni will be able to map the machine request to the link immediately as the machine joins.

NOTE: Only use this configuration when the join config is supplied though a metadata server, nocloud image or similar flows. Trying to encode that into a machine schematic will cause the provision to fail.

func WithHealthCheckFunc added in v0.46.0

func WithHealthCheckFunc(healthCheckFunc HealthCheckFunc) Option

WithHealthCheckFunc sets the health check function for the infra provider.

The health check function should return a descriptive error if the provider is unhealthy.

func WithHealthCheckInterval added in v0.46.0

func WithHealthCheckInterval(interval time.Duration) Option

WithHealthCheckInterval sets the health check interval for the infra provider.

func WithImageFactoryClient

func WithImageFactoryClient(imageFactory provision.FactoryClient) Option

WithImageFactoryClient sets up the image factory client explicitly.

func WithOmniEndpoint

func WithOmniEndpoint(value string) Option

WithOmniEndpoint sets Omni API client endpoint to use.

func WithState

func WithState(state state.State) Option

WithState sets the COSI runtime state explicitly. If not set, the infra provider will create Omni API client and get the state from it. This option is intended to be used in the advanced use cases, when it's needed to create a custom state.

type Options

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

Options defines additional infra provider options.

type Provider

type Provider[T generic.ResourceWithRD] struct {
	// contains filtered or unexported fields
}

Provider runner.

func NewProvider

func NewProvider[V any, T RD[V]](
	id string,
	provisioner provision.Provisioner[T],
	config ProviderConfig,
) (*Provider[T], error)

NewProvider creates a new infra provider and registers provider state resource in the COSI state.

func (*Provider[T]) Run

func (provider *Provider[T]) Run(ctx context.Context, logger *zap.Logger, opts ...Option) error

Run the infra provider.

type ProviderConfig added in v0.45.0

type ProviderConfig struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
	Icon        string `yaml:"icon,omitempty"`
	Schema      string `yaml:"schema"`
}

ProviderConfig defines the schema, human-readable provider name and description.

func ParseProviderConfig added in v0.45.0

func ParseProviderConfig(data []byte) (ProviderConfig, error)

ParseProviderConfig loads provider config from the yaml data.

type RD

type RD[V any] interface {
	generic.ResourceWithRD
	protobuf.ResourceUnmarshaler
	*V
}

RD defines contract for the resource definition.

type State

type State struct {
	Client *client.Client
}

State creates new infra provider state.

func NewState

func NewState(client *client.Client) (*State, error)

NewState creates new infra provider state.

func (*State) State

func (s *State) State() state.State

State returns COSI state.

Directories

Path Synopsis
Package controllers implements common controllers for the infra providers.
Package controllers implements common controllers for the infra providers.
Package imagefactory implements factory clients used in the infra providers.
Package imagefactory implements factory clients used in the infra providers.
internal
resources
Package resources contains COSI resource helpers for the infra provider.
Package resources contains COSI resource helpers for the infra provider.
Package provision defines the interface for the infra provisioner.
Package provision defines the interface for the infra provisioner.

Jump to

Keyboard shortcuts

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