infra

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MPL-2.0 Imports: 16 Imported by: 1

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