namespaces

package
v1.4.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package namespaces provides the functionality to manage namespaces.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNSEmpty appears when the provided list of the namespaces is considered empty.
	ErrNSEmpty = errors.New("namespace list is empty. Specify at least one namespace")
	// ErrNSReserved appears when some of the provided names are forbidden to use.
	ErrNSReserved = func(ns string) error {
		return fmt.Errorf("'%s' namespace is reserved for Everest internals. Please specify another namespace", ns)
	}
	// ErrNameNotRFC1035Compatible appears when some of the provided names are not RFC1035 compatible.
	ErrNameNotRFC1035Compatible = func(fieldName string) error {
		return fmt.Errorf(`'%s' is not RFC 1035 compatible. The name should contain only lowercase alphanumeric characters or '-', start with an alphabetic character, end with an alphanumeric character`,
			fieldName,
		)
	}
	// ErrNoOperatorsSelected appears when no operators are selected for installation.
	ErrNoOperatorsSelected = errors.New("no operators selected for installation. Minimum one operator must be selected")
)
View Source
var (
	// ErrNsDoesNotExist appears when the namespace does not exist.
	ErrNsDoesNotExist = errors.New("namespace does not exist")
	// ErrNamespaceNotManagedByEverest appears when the namespace is not managed by Everest.
	ErrNamespaceNotManagedByEverest = errors.New("namespace is not managed by Everest")
	// ErrNamespaceAlreadyExists appears when the namespace already exists.
	ErrNamespaceAlreadyExists = errors.New("namespace already exists")
	// ErrNamespaceAlreadyOwned appears when the namespace is already owned by Everest.
	ErrNamespaceAlreadyOwned = errors.New("namespace already exists and is managed by Everest")
)
View Source
var ErrNamespaceNotEmpty = errors.New("cannot remove namespace with running database clusters")

ErrNamespaceNotEmpty is returned when the namespace is not empty.

Functions

func NewRemoveNamespaceSteps

func NewRemoveNamespaceSteps(namespace string, keepNs bool, k *kubernetes.Kubernetes) []steps.Step

NewRemoveNamespaceSteps returns the steps to remove a namespace.

func ValidateNamespaces

func ValidateNamespaces(str string) ([]string, error)

ValidateNamespaces validates a comma-separated namespaces string.

Types

type NamespaceAddConfig

type NamespaceAddConfig struct {
	// Namespaces to install.
	Namespaces string `mapstructure:"namespaces"`
	// SkipWizard is set if the wizard should be skipped.
	SkipWizard bool `mapstructure:"skip-wizard"`
	// KubeconfigPath is the path to the kubeconfig file.
	KubeconfigPath string `mapstructure:"kubeconfig"`
	// DisableTelemetry is set if telemetry should be disabled.
	DisableTelemetry bool `mapstructure:"disable-telemetry"`
	// TakeOwnership of an existing namespace.
	TakeOwnership bool `mapstructure:"take-ownership"`

	Operator OperatorConfig

	// Pretty print the output.
	Pretty bool

	// Update is set if the existing namespace needs to be updated.
	// This flag is set internally only, so that the add functionality may
	// be re-used for updating the namespace as well.
	Update bool
	// NamespaceList is a list of namespaces to install.
	// This is populated internally after validating the Namespaces field.:
	NamespaceList []string

	helm.CLIOptions
}

NamespaceAddConfig is the configuration for adding namespaces.

func (*NamespaceAddConfig) Populate

func (cfg *NamespaceAddConfig) Populate(ctx context.Context, askNamespaces, askOperators bool) error

Populate the configuration with the required values.

type NamespaceAdder

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

NamespaceAdder provides the functionality to add namespaces.

func NewNamespaceAdd

func NewNamespaceAdd(c NamespaceAddConfig, l *zap.SugaredLogger) (*NamespaceAdder, error)

NewNamespaceAdd returns a new CLI operation to add namespaces.

func (*NamespaceAdder) Run

func (n *NamespaceAdder) Run(ctx context.Context) error

Run namespace add operation.

type NamespaceRemoveConfig

type NamespaceRemoveConfig struct {
	// KubeconfigPath is a path to a kubeconfig
	KubeconfigPath string `mapstructure:"kubeconfig"`
	// Force delete a namespace by deleting databases in it.
	Force bool `mapstructure:"force"`
	// If set, we will keep the namespace
	KeepNamespace bool `mapstructure:"keep-namespace"`
	// If set, we will print the pretty output.
	Pretty bool

	// Namespaces (DB Namespaces) to remove
	Namespaces []string
}

NamespaceRemoveConfig is the configuration for the namespace removal operation.

type NamespaceRemover

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

NamespaceRemover is the CLI operation to remove namespaces.

func NewNamespaceRemove

func NewNamespaceRemove(c NamespaceRemoveConfig, l *zap.SugaredLogger) (*NamespaceRemover, error)

NewNamespaceRemove returns a new CLI operation to remove namespaces.

func (*NamespaceRemover) Run

func (r *NamespaceRemover) Run(ctx context.Context) error

Run the namespace removal operation.

type OperatorConfig

type OperatorConfig struct {
	// PG stores if PostgresSQL shall be installed.
	PG bool `mapstructure:"postgresql"`
	// PSMDB stores if MongoDB shall be installed.
	PSMDB bool `mapstructure:"mongodb"`
	// PXC stores if XtraDB Cluster shall be installed.
	PXC bool `mapstructure:"xtradb-cluster"`
}

OperatorConfig identifies which operators shall be installed.

Jump to

Keyboard shortcuts

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