hook

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckErr

func CheckErr(err error)

func GetKubeBlocksDeploy

func GetKubeBlocksDeploy(ctx context.Context, client *kubernetes.Clientset, ns string, componentName string) (*appsv1.Deployment, error)

GetKubeBlocksDeploy gets deployment include KubeBlocks.

func Log

func Log(format string, a ...any)

func PrepareFor

func PrepareFor(ctx *UpgradeContext) (err error)

func RegisterCRDConversion

func RegisterCRDConversion(gvr schema.GroupVersionResource, newVersion Version, handler ConversionHandler, oldVersions ...Version)

Types

type Addon

type Addon struct {
	BasedHandler

	KeepAddons bool
}

func (*Addon) Handle

func (p *Addon) Handle(ctx *UpgradeContext) (err error)

func (*Addon) IsSkip

func (p *Addon) IsSkip(*UpgradeContext) (bool, error)

type BasedHandler

type BasedHandler struct {
	ContextHandler
}

func (*BasedHandler) IsSkip

func (b *BasedHandler) IsSkip(*UpgradeContext) (bool, error)

type CRClient

type CRClient struct {
	*dynamic.DynamicClient

	KBClient  *versioned.Clientset
	K8sClient *kubernetes.Clientset
	CRDClient *clientset.Clientset
}

type ContextHandler

type ContextHandler interface {
	IsSkip(*UpgradeContext) (bool, error)
	Handle(*UpgradeContext) error
}

ContextHandler is the interface for a "chunk" of reconciliation. It either returns, often by adjusting the current key's place in the queue (i.e. via requeue or done) or calls another handler in the chain.

type ContextHandlerFunc

type ContextHandlerFunc func(ctx *UpgradeContext) error

ContextHandlerFunc is a function type that implements ContextHandler

func (ContextHandlerFunc) Handle

func (f ContextHandlerFunc) Handle(ctx *UpgradeContext) error

type Conversion

type Conversion struct {
	BasedHandler
}

func (*Conversion) Handle

func (p *Conversion) Handle(ctx *UpgradeContext) (err error)

type ConversionHandler

type ConversionHandler interface {
	Convert(context.Context, CRClient) ([]client.Object, error)
}

type ConversionMeta

type ConversionMeta struct {
	ConversionHandler
	FromVersion []Version
	ToVersion   Version
}

type StopOperator

type StopOperator struct {
	BasedHandler
}

func (*StopOperator) Handle

func (p *StopOperator) Handle(ctx *UpgradeContext) error

type UpdateCR

type UpdateCR struct {
	BasedHandler
}

func (*UpdateCR) Handle

func (u *UpdateCR) Handle(context *UpgradeContext) error

type UpdateCRD

type UpdateCRD struct {
	BasedHandler
}

func (*UpdateCRD) Handle

func (p *UpdateCRD) Handle(ctx *UpgradeContext) (err error)

type UpgradeContext

type UpgradeContext struct {
	UpgradeMetaContext

	From *Version
	To   Version

	UpdatedObjects map[schema.GroupVersionResource][]client.Object
}

func NewUpgradeContext

func NewUpgradeContext(ctx context.Context, config *restclient.Config, version string, crd string, ns string) *UpgradeContext

type UpgradeMetaContext

type UpgradeMetaContext struct {
	context.Context

	CRDPath   string
	Version   string
	Namespace string

	CRClient
}

type Version

type Version struct {
	Major int32
	Minor int32
}

func NewNoVersion

func NewNoVersion(major, minor int32) Version

func NewVersion

func NewVersion(version string) (*Version, error)

func (Version) String

func (v Version) String() string

type Workflow

type Workflow []ContextHandlerFunc

func NewUpgradeWorkflow

func NewUpgradeWorkflow() Workflow

func (Workflow) AddStage

func (w Workflow) AddStage(stage ContextHandler) Workflow

func (Workflow) Do

func (w Workflow) Do(ctx *UpgradeContext) error

func (Workflow) WrapStage

func (w Workflow) WrapStage(stageFn ContextHandlerFunc) Workflow

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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