machine

package
v1.9.0-industry.4 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 16 Imported by: 2

Documentation

Index

Constants

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

	ConditionTypeDone = "EnsureDone"

	ConditionTypeHealthCheck = "HealthCheck"
	FailedHealthCheckReason  = "FailedHealthCheck"
)

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
	ValidateUpdate(machine *platform.Machine, oldMachine *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
	// OnHealthCheck could be implemented by user, and default implementation is checking
	// tenant cluster node status by machine IP
	OnHealthCheck(ctx context.Context, machine *platformv1.Machine, cluster *typesv1.Cluster) *platformv1.Machine
}

ControllerProvider ControllerProvider

type DelegateProvider added in v1.3.1

type DelegateProvider struct {
	ProviderName string

	ValidateFunc       func(machine *platform.Machine) field.ErrorList
	ValidateUpdateFunc func(machine *platform.Machine, oldMachine *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) OnHealthCheck added in v1.9.1

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

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

func (*DelegateProvider) ValidateUpdate added in v1.9.0

func (p *DelegateProvider) ValidateUpdate(machine *platform.Machine, oldMachine *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