cluster

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReasonFailedProcess     = "FailedProcess"
	ReasonWaitingProcess    = "WaitingProcess"
	ReasonSuccessfulProcess = "SuccessfulProcess"
	ReasonSkipProcess       = "SkipProcess"

	ConditionTypeDone = "EnsureDone"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CpManager

type CpManager struct {
	sync.RWMutex
	Cp map[string]Provider
}

func New

func New() *CpManager

func (*CpManager) GetProvider

func (p *CpManager) GetProvider(name string) (Provider, error)

GetProvider returns provider by name

func (*CpManager) Providers

func (p *CpManager) Providers() []string

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

func (*CpManager) Register

func (p *CpManager) 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.

func (*CpManager) RegisterHandler

func (p *CpManager) RegisterHandler(mux *mux.PathRecorderMux)

RegisterHandler register all provider's hanlder.

type DelegateProvider

type DelegateProvider struct {
	ProviderName string

	ValidateFunc    func(ctx *common.ClusterContext) field.ErrorList
	PreCreateFunc   func(ctx *common.ClusterContext) error
	AfterCreateFunc func(ctx *common.ClusterContext) error

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

func (*DelegateProvider) AfterCreate

func (p *DelegateProvider) AfterCreate(ctx *common.ClusterContext) error

func (*DelegateProvider) Name

func (p *DelegateProvider) Name() string

func (*DelegateProvider) OnCreate

func (p *DelegateProvider) OnCreate(ctx *common.ClusterContext) error

func (*DelegateProvider) OnDelete

func (p *DelegateProvider) OnDelete(ctx *common.ClusterContext) error

func (*DelegateProvider) OnUpdate

func (p *DelegateProvider) OnUpdate(ctx *common.ClusterContext) error

func (*DelegateProvider) PreCreate

func (p *DelegateProvider) PreCreate(ctx *common.ClusterContext) error

func (*DelegateProvider) RegisterHandler

func (p *DelegateProvider) RegisterHandler(mux *mux.PathRecorderMux)

func (*DelegateProvider) Validate

type Handler

type Handler func(ctx *common.ClusterContext) error

func (Handler) Name

func (h Handler) Name() string

type Provider

type Provider interface {
	Name() string

	RegisterHandler(mux *mux.PathRecorderMux)

	Validate(ctx *common.ClusterContext) field.ErrorList

	PreCreate(ctx *common.ClusterContext) error
	AfterCreate(ctx *common.ClusterContext) error

	OnCreate(ctx *common.ClusterContext) error
	OnUpdate(ctx *common.ClusterContext) error
	OnDelete(ctx *common.ClusterContext) error
}

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

Jump to

Keyboard shortcuts

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