cluster

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: 22 Imported by: 4

Documentation

Index

Constants

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

	ConditionTypeDone = "EnsureDone"
)
View Source
const AdminUsername = "admin"

Variables

This section is empty.

Functions

func GetCluster added in v1.8.0

func GetCluster(ctx context.Context, platformClient internalversion.PlatformInterface, cluster *platform.Cluster, username string) (*types.Cluster, error)

func GetClusterByName added in v1.8.0

func GetClusterByName(ctx context.Context, platformClient internalversion.PlatformInterface, clsname, username string) (*types.Cluster, error)

func GetV1Cluster added in v1.8.0

func GetV1Cluster(ctx context.Context, platformClient platformversionedclient.PlatformV1Interface, cluster *platformv1.Cluster, username string) (*v1.Cluster, error)

func GetV1ClusterByName added in v1.8.0

func GetV1ClusterByName(ctx context.Context, platformClient platformversionedclient.PlatformV1Interface, clsname, username string) (*v1.Cluster, error)

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.

func RegisterHandler added in v1.3.1

func RegisterHandler(mux *mux.PathRecorderMux)

RegisterHandler register all provider's hanlder.

func Setup added in v1.3.1

func Setup() error

Setup call all provider's setup method.

func Teardown added in v1.3.1

func Teardown() error

Teardown call all provider's teardown method.

Types

type APIProvider added in v1.3.1

type APIProvider interface {
	RegisterHandler(mux *mux.PathRecorderMux)
	Validate(cluster *types.Cluster) field.ErrorList
	PreCreate(cluster *types.Cluster) error
	AfterCreate(cluster *types.Cluster) error
}

type ControllerProvider added in v1.3.1

type ControllerProvider interface {
	// Setup called by controller to give an chance for plugin do some init work.
	Setup() error
	// Teardown called by controller for plugin do some clean job.
	Teardown() error
	// NeedUpdate could be implemented by user to judge whether cluster need update or not.
	NeedUpdate(old, new *platformv1.Cluster) bool

	OnCreate(ctx context.Context, cluster *v1.Cluster) error
	OnUpdate(ctx context.Context, cluster *v1.Cluster) error
	OnDelete(ctx context.Context, cluster *v1.Cluster) error
	// OnFilter called by cluster controller informer for plugin
	// do the filter on the cluster obj for specific case:
	// return bool:
	//  false: drop the object to the queue
	//  true: add the object to queue, AddFunc and UpdateFunc will
	//  go through later
	OnFilter(ctx context.Context, cluster *platformv1.Cluster) bool
	// OnRunning call on first running.
	OnRunning(ctx context.Context, cluster *v1.Cluster) error
}

type CredentialProvider added in v1.8.0

type CredentialProvider interface {
	GetClusterCredential(ctx context.Context, client platforminternalclient.PlatformInterface, cluster *platform.Cluster, username string) (*platform.ClusterCredential, error)
	GetClusterCredentialV1(ctx context.Context, client platformversionedclient.PlatformV1Interface, cluster *platformv1.Cluster, username string) (*platformv1.ClusterCredential, error)
}

type DelegateProvider added in v1.3.1

type DelegateProvider struct {
	ProviderName string

	ValidateFunc    func(cluster *types.Cluster) field.ErrorList
	PreCreateFunc   func(cluster *types.Cluster) error
	AfterCreateFunc func(cluster *types.Cluster) error

	CreateHandlers    []Handler
	DeleteHandlers    []Handler
	UpdateHandlers    []Handler
	UpgradeHandlers   []Handler
	ScaleUpHandlers   []Handler
	ScaleDownHandlers []Handler
}

func (*DelegateProvider) AfterCreate added in v1.3.1

func (p *DelegateProvider) AfterCreate(cluster *types.Cluster) error

func (*DelegateProvider) GetClusterCredential added in v1.8.0

func (p *DelegateProvider) GetClusterCredential(ctx context.Context, client platforminternalclient.PlatformInterface, cluster *platform.Cluster, username string) (*platform.ClusterCredential, error)

GetClusterCredential returns the cluster's credential

func (*DelegateProvider) GetClusterCredentialV1 added in v1.8.0

GetClusterCredentialV1 returns the versioned cluster's credential

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.Cluster) bool

func (*DelegateProvider) OnCreate added in v1.3.1

func (p *DelegateProvider) OnCreate(ctx context.Context, cluster *v1.Cluster) error

func (*DelegateProvider) OnDelete added in v1.3.1

func (p *DelegateProvider) OnDelete(ctx context.Context, cluster *v1.Cluster) error

func (*DelegateProvider) OnFilter added in v1.8.0

func (p *DelegateProvider) OnFilter(ctx context.Context, cluster *platformv1.Cluster) (pass bool)

func (*DelegateProvider) OnRunning added in v1.3.1

func (p *DelegateProvider) OnRunning(ctx context.Context, cluster *v1.Cluster) error

func (*DelegateProvider) OnUpdate added in v1.3.1

func (p *DelegateProvider) OnUpdate(ctx context.Context, cluster *v1.Cluster) error

func (*DelegateProvider) PreCreate added in v1.3.1

func (p *DelegateProvider) PreCreate(cluster *types.Cluster) error

func (*DelegateProvider) RegisterHandler added in v1.3.1

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

func (*DelegateProvider) Setup added in v1.3.1

func (p *DelegateProvider) Setup() error

func (*DelegateProvider) Teardown added in v1.3.1

func (p *DelegateProvider) Teardown() error

func (*DelegateProvider) Validate added in v1.3.1

func (p *DelegateProvider) Validate(cluster *types.Cluster) field.ErrorList

type Handler added in v1.3.1

type Handler func(context.Context, *v1.Cluster) error

func (Handler) Name added in v1.3.1

func (h Handler) Name() string

type Provider

type Provider interface {
	Name() string

	APIProvider
	ControllerProvider
	CredentialProvider
}

Provider defines a set of response interfaces for specific cluster types in cluster 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