cluster

package
v1.1.1-0...-18dfa52 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultConfigDir    = "config"
	DefaultCacheDir     = "cache"
	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 NewConfigChangeError

func NewConfigChangeError(msg string, paths ...string) error

func NewConfigChangeWarning

func NewConfigChangeWarning(msg string, paths ...string) error

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     *config.Config
	AppliedConfig *config.Config
	InfraConfig   *infra.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) Manager

func (c *Cluster) Manager() interfaces.Manager

Manager returns a manager instance that is responsible for managing Kubernetes cluster on provisioned instances.

func (*Cluster) Provisioner

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

Provisioner function returns a provisioner instance that is responsible for provisioning virtual infrastructure based on the configuration file provided as input.

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) CacheDir

func (c ClusterMeta) CacheDir() 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 the cluster and removes cluster's directory. Terraform resources are wiped if terraform state file is found.

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

type ConfigMock

type ConfigMock struct {
	ClusterName string
}

func (ConfigMock) Name

func (c ConfigMock) Name() string

func (*ConfigMock) SetDefaults

func (c *ConfigMock) SetDefaults()

func (ConfigMock) Template

func (c ConfigMock) Template() (string, error)

func (ConfigMock) Write

func (c ConfigMock) Write(t *testing.T) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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