machine

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 15 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ReasonWaiting      = "Waiting"
	ReasonSkip         = "Skip"
	ReasonFailedInit   = "FailedInit"
	ReasonFailedUpdate = "FailedUpdate"
	ReasonFailedDelete = "FailedDelete"

	ConditionTypeDone = "EnsureDone"
)

Variables

This section is empty.

Functions

func Providers

func Providers() []string

Providers returns a sorted list of the names of the registered providers.

func Register

func Register(name string, provider Provider)

Register makes a provider available by the provided name. If Register is called twice with the same name or if provider is nil, it panics.

Types

type APIProvider added in v1.8.0

type APIProvider interface {
	Validate(machine *platform.Machine) field.ErrorList
}

type ControllerProvider added in v1.8.0

type ControllerProvider interface {
	// NeedUpdate could be implemented by user to judge whether machine need update or not.
	NeedUpdate(old, new *platformv1.Machine) bool

	PreCreate(machine *platform.Machine) error
	AfterCreate(machine *platform.Machine) error

	OnCreate(ctx context.Context, machine *platformv1.Machine, cluster *typesv1.Cluster) error
	OnUpdate(ctx context.Context, machine *platformv1.Machine, cluster *typesv1.Cluster) error
	OnDelete(ctx context.Context, machine *platformv1.Machine, cluster *typesv1.Cluster) error
}

type DelegateProvider added in v1.3.1

type DelegateProvider struct {
	ProviderName string

	ValidateFunc    func(machine *platform.Machine) field.ErrorList
	PreCreateFunc   func(machine *platform.Machine) error
	AfterCreateFunc func(machine *platform.Machine) error

	CreateHandlers []Handler
	DeleteHandlers []Handler
	UpdateHandlers []Handler
}

func (*DelegateProvider) AfterCreate added in v1.3.1

func (p *DelegateProvider) AfterCreate(machine *platform.Machine) error

func (*DelegateProvider) Name added in v1.3.1

func (p *DelegateProvider) Name() string

func (*DelegateProvider) NeedUpdate added in v1.8.0

func (p *DelegateProvider) NeedUpdate(old, new *platformv1.Machine) bool

func (*DelegateProvider) OnCreate added in v1.3.1

func (p *DelegateProvider) OnCreate(ctx context.Context, machine *platformv1.Machine, cluster *typesv1.Cluster) error

func (*DelegateProvider) OnDelete added in v1.3.1

func (p *DelegateProvider) OnDelete(ctx context.Context, machine *platformv1.Machine, cluster *typesv1.Cluster) error

func (*DelegateProvider) OnUpdate added in v1.3.1

func (p *DelegateProvider) OnUpdate(ctx context.Context, machine *platformv1.Machine, cluster *typesv1.Cluster) error

func (*DelegateProvider) PreCreate added in v1.3.1

func (p *DelegateProvider) PreCreate(machine *platform.Machine) error

func (*DelegateProvider) Validate added in v1.3.1

func (p *DelegateProvider) Validate(machine *platform.Machine) field.ErrorList

type Handler added in v1.3.1

func (Handler) Name added in v1.3.1

func (h Handler) Name() string

type Provider

type Provider interface {
	Name() string

	APIProvider
	ControllerProvider
}

Provider defines a set of response interfaces for specific machine types in machine management.

func GetProvider

func GetProvider(name string) (Provider, error)

GetProvider returns provider by name

Jump to

Keyboard shortcuts

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