installer

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotImplemented is the error returned if a method is not implemented.
	ErrNotImplemented = errors.New("installer: not implemented")
	// ErrReleaseNotFound indicates that a component release is not found.
	ErrReleaseNotFound = errors.New("installer: release not found")
)

Functions

func IsNotImplemented

func IsNotImplemented(err error) bool

IsNotImplemented returns true if the specified error is ErrNotImplemented.

func IsReleaseNotFound

func IsReleaseNotFound(err error) bool

IsReleaseNotFound returns true if the specified error is ErrReleaseNotFound.

func MustRegister

func MustRegister(name string, factory Factory)

MustRegister registers a Factory by name and panics if an error occurs.

func Register

func Register(name string, factory Factory) error

Register registers a Factory by name and returns an error, if any.

Types

type Factory

type Factory func(options *InstallerOptions) (Installer, error)

Factory is a function that returns an Installer interface. An error is returned if the installer fails to initialize, nil otherwise.

func GetFactory

func GetFactory(name string) (Factory, error)

GetFactory returns a Factory by name.

type Installer

type Installer interface {
	// Get returns details of a component release by name.
	Get(name oceanv1alpha1.OceanComponentName) (*Release, error)
	// Install installs a component to a cluster.
	Install(component *oceanv1alpha1.OceanComponent) (*Release, error)
	// Uninstall uninstalls a component from a cluster.
	Uninstall(component *oceanv1alpha1.OceanComponent) error
	// Upgrade upgrades a component to a cluster.
	Upgrade(component *oceanv1alpha1.OceanComponent) (*Release, error)
	// IsUpgrade determines whether a component release is an upgrade.
	IsUpgrade(component *oceanv1alpha1.OceanComponent, release *Release) bool
}

Installer defines the interface of a component installer.

func GetInstance

func GetInstance(name string, options ...InstallerOption) (Installer, error)

GetInstance returns an instance of installer by name.

type InstallerOption

type InstallerOption interface {
	// MutateInstallerOptions applies this configuration to the given InstallerOptions.
	MutateInstallerOptions(options *InstallerOptions)
}

InstallerOption is some configuration that modifies options for an Installer.

func WithClientGetter

func WithClientGetter(getter genericclioptions.RESTClientGetter) InstallerOption

WithClientGetter sets the given RESTClientGetter.

func WithLogger

func WithLogger(log log.Logger) InstallerOption

WithLogger sets the given logger.

func WithNamespace

func WithNamespace(namespace string) InstallerOption

WithNamespace sets the given namespace.

type InstallerOptionFunc

type InstallerOptionFunc func(options *InstallerOptions)

InstallerOptionFunc is a convenience type like http.HandlerFunc.

func (InstallerOptionFunc) MutateInstallerOptions

func (f InstallerOptionFunc) MutateInstallerOptions(options *InstallerOptions)

MutateInstallerOptions implements the InstallerOption interface.

type InstallerOptions

type InstallerOptions struct {
	Namespace    string
	ClientGetter genericclioptions.RESTClientGetter
	Log          log.Logger
}

type Release

type Release struct {
	// Name is the name of the release.
	Name string `json:"name,omitempty"`
	// Version is a SemVer 2 conformant version string of the release.
	Version string `json:"version,omitempty"`
	// AppVersion is the version of the application enclosed inside of this release.
	AppVersion string `json:"appVersion,omitempty"`
	// Status is the current state of the release.
	Status ReleaseStatus `json:"status,omitempty"`
	// Description is human-friendly "log entry" about this release.
	Description string `json:"description,omitempty"`
	// Values is the set of extra values added to the release.
	Values map[string]interface{} `json:"values,omitempty"`
}

Release describes a deployment of a component. For Helm-based components, it represents a Helm release (i.e. a chart installed into a cluster).

type ReleaseStatus

type ReleaseStatus string

ReleaseStatus is the status of a release.

const (
	// ReleaseStatusUnknown indicates that a release is in an uncertain state.
	ReleaseStatusUnknown ReleaseStatus = "Unknown"
	// ReleaseStatusDeployed indicates that a release has been deployed to Kubernetes.
	ReleaseStatusDeployed ReleaseStatus = "Deployed"
	// ReleaseStatusUninstalled indicates that a release has been uninstalled from Kubernetes.
	ReleaseStatusUninstalled ReleaseStatus = "Uninstalled"
	// ReleaseStatusFailed indicates that the release was not successfully deployed.
	ReleaseStatusFailed ReleaseStatus = "Failed"
	// ReleaseStatusProgressing indicates that a release is in progress.
	ReleaseStatusProgressing ReleaseStatus = "Progressing"
)

These are valid release statuses.

func (ReleaseStatus) String

func (x ReleaseStatus) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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