lcm

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatabasePropertyName string = "database"
	StoragePropertyName  string = "storage"
	CachePropertyName    string = "cache"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CRStatus

type CRStatus struct {
	Condition  goharborv1.HarborClusterCondition `json:"condition"`
	Properties Properties                        `json:"properties"`
}

func New

New returns new CRStatus.

func (*CRStatus) WithMessage

func (cs *CRStatus) WithMessage(message string) *CRStatus

WithMessage returns CRStatus with Condition message.

func (*CRStatus) WithProperties

func (cs *CRStatus) WithProperties(properties Properties) *CRStatus

WithProperties returns CRStatus with Properties.

func (*CRStatus) WithReason

func (cs *CRStatus) WithReason(reason string) *CRStatus

WithReason returns CRStatus with Condition reason.

func (*CRStatus) WithStatus

func (cs *CRStatus) WithStatus(status corev1.ConditionStatus) *CRStatus

WithStatus returns CRStatus with Condition status.

type CRStatusCollection

type CRStatusCollection struct {
	// contains filtered or unexported fields
}

CRStatusCollection is designed for collecting CRStatus of each dependant components.

func NewCRStatusCollection

func NewCRStatusCollection() *CRStatusCollection

NewCRStatusCollection returns a new collection.

func (*CRStatusCollection) Get

func (c *CRStatusCollection) Get(component goharborv1.Component) (*CRStatus, bool)

Get item from collection.

func (*CRStatusCollection) Set

func (c *CRStatusCollection) Set(component goharborv1.Component, status *CRStatus)

Set item to collection.

type Controller

type Controller interface {
	// Apply the changes to the cluster including:
	// - create new if the designed resource is not existing
	// - update the resource if the related spec has been changed
	// - scale the resources if the replica is changed
	//
	// Equal to the previous method "Reconcile()" of lcm Controller
	Apply(ctx context.Context, harborcluster *goharborv1.HarborCluster, options ...Option) (*CRStatus, error)

	// Delete the related resources if the resource configuration is removed from the spec.
	// As we support connecting to the external or incluster provisioned dependent services,
	// the dependent service may switch from incluster to external mode and then the incluster
	// services may need to be unloaded.
	Delete(ctx context.Context, harborcluster *goharborv1.HarborCluster) (*CRStatus, error)

	// Upgrade the specified resource to the given version.
	Upgrade(ctx context.Context, harborcluster *goharborv1.HarborCluster) (*CRStatus, error)
}

Controller is designed to handle the lifecycle of the related incluster deployed services like psql, redis and minio.

type Option

type Option func(options *Options)

Option func for lcm.

func WithDependencies

func WithDependencies(dependencies *CRStatusCollection) Option

WithDependencies option.

type Options

type Options struct {
	Dependencies *CRStatusCollection
}

Options for lcm.

type Properties

type Properties []*Property

func (*Properties) Add

func (ps *Properties) Add(name string, value interface{})

Add append a new property to properties.

func (*Properties) Get

func (ps *Properties) Get(name string) *Property

Get retrieves properties according to the given name.

func (*Properties) Update

func (ps *Properties) Update(name string, value interface{})

Update updates properties according to the given arguments.

type Property

type Property struct {
	// Name, e.p: Connection,Port.
	Name string
	// Value, e.p: "rfs-harborcluster-sample.svc"
	Value interface{}
}

Property is the current property of component.

func (*Property) ToFloat64

func (p *Property) ToFloat64() float64

ToFloat64 parse properties value to float64 type.

func (*Property) ToInt

func (p *Property) ToInt() int

ToInt parse properties value to int type.

func (*Property) ToString

func (p *Property) ToString() string

ToString parse properties value to string type.

Jump to

Keyboard shortcuts

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