cluster

package
v0.0.0-...-947b840 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConfigDir    = "config"
	DefaultShareDir     = "share"
	DefaultTerraformDir = DefaultConfigDir + "/terraform"

	DefaultNewConfigFilename     = "kubitect.yaml"
	DefaultAppliedConfigFilename = "kubitect-applied.yaml"
	DefaultInfraConfigFilename   = "infrastructure.yaml"

	DefaultTerraformStateFilename = "terraform.tfstate"
	DefaultKubeconfigFilename     = "admin.conf"
)

Variables

This section is empty.

Functions

func NewInvalidClusterDirError

func NewInvalidClusterDirError(missingFiles []string) error

func NewValidationError

func NewValidationError(msg string, path string) error

Types

type ApplyAction

type ApplyAction string
const (
	UNKNOWN ApplyAction = "unknown"
	CREATE  ApplyAction = "create"
	UPGRADE ApplyAction = "upgrade"
	SCALE   ApplyAction = "scale"
)

func ToApplyActionType

func ToApplyActionType(a string) (ApplyAction, error)

func (ApplyAction) String

func (a ApplyAction) String() string

type Cluster

type Cluster struct {
	ClusterMeta

	NewConfigPath string

	// Configuration files
	NewConfig     *modelconfig.Config
	AppliedConfig *modelconfig.Config
	InfraConfig   *modelinfra.Config
}

func NewCluster

func NewCluster(ctx app.AppContext, configPath string) (*Cluster, error)

NewCluster returns new Cluster instance with populated general fields. Cluster name and path are extracted from the provided configuration file. Previously applied configuration is also read, if cluster already exists.

func (*Cluster) Apply

func (c *Cluster) Apply(a string) error

Apply either creates new or modifies an existing cluster, based on the provided action.

func (*Cluster) ApplyNewConfig

func (c *Cluster) ApplyNewConfig() error

ApplyNewConfig replaces currently applied config with new one.

func (*Cluster) Executor

func (c *Cluster) Executor() executors.Executor

func (*Cluster) Provisioner

func (c *Cluster) Provisioner() provisioner.Provisioner

func (*Cluster) StoreNewConfig

func (c *Cluster) StoreNewConfig() error

StoreNewConfig makes a copy of the provided (new) configuration file in cluster directory.

func (*Cluster) Sync

func (c *Cluster) Sync() error

Sync ensures that cluster configuration files are up to data.

type ClusterMeta

type ClusterMeta struct {
	app.AppContext

	Name  string
	Path  string
	Local bool
	// contains filtered or unexported fields
}

func (ClusterMeta) AppliedConfigPath

func (c ClusterMeta) AppliedConfigPath() string

func (ClusterMeta) ConfigDir

func (c ClusterMeta) ConfigDir() string

func (ClusterMeta) ContainsAppliedConfig

func (c ClusterMeta) ContainsAppliedConfig() bool

func (ClusterMeta) ContainsKubeconfig

func (c ClusterMeta) ContainsKubeconfig() bool

func (ClusterMeta) ContainsTfStateConfig

func (c ClusterMeta) ContainsTfStateConfig() bool

func (*ClusterMeta) Destroy

func (c *ClusterMeta) Destroy() error

Destroy destroys an active cluster and removes cluster's directory. If cluster does not exist or does not contain a terraform state file (is inactive), an error is returned.

func (ClusterMeta) InfrastructureConfigPath

func (c ClusterMeta) InfrastructureConfigPath() string

func (ClusterMeta) KubeconfigPath

func (c ClusterMeta) KubeconfigPath() string

func (ClusterMeta) PrivateSshKeyPath

func (c ClusterMeta) PrivateSshKeyPath() string

func (*ClusterMeta) Provisioner

func (c *ClusterMeta) Provisioner() provisioner.Provisioner

func (ClusterMeta) TfStatePath

func (c ClusterMeta) TfStatePath() string

type ClusterMock

type ClusterMock struct {
	*Cluster
	// contains filtered or unexported fields
}

func MockCluster

func MockCluster(t *testing.T) *ClusterMock

func MockLocalCluster

func MockLocalCluster(t *testing.T) *ClusterMock

func (*ClusterMock) AppContext

func (m *ClusterMock) AppContext() app.AppContextMock

func (*ClusterMock) Ui

func (m *ClusterMock) Ui() ui.UiMock

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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