Documentation
¶
Index ¶
- Constants
- func NewConfigChangeError(msg string, paths ...string) error
- func NewConfigChangeWarning(msg string, paths ...string) error
- func NewInvalidClusterDirError(missingFiles []string) error
- func NewValidationError(msg string, path string) error
- type ApplyAction
- type Cluster
- type ClusterMeta
- func (c ClusterMeta) AppliedConfigPath() string
- func (c ClusterMeta) CacheDir() string
- func (c ClusterMeta) ConfigDir() string
- func (c ClusterMeta) ContainsAppliedConfig() bool
- func (c ClusterMeta) ContainsKubeconfig() bool
- func (c ClusterMeta) ContainsTfStateConfig() bool
- func (c *ClusterMeta) Destroy() error
- func (c ClusterMeta) InfrastructureConfigPath() string
- func (c ClusterMeta) KubeconfigPath() string
- func (c ClusterMeta) PrivateSshKeyPath() string
- func (c *ClusterMeta) Provisioner() provisioner.Provisioner
- func (c ClusterMeta) TfStatePath() string
- type ClusterMock
- type ConfigMock
Constants ¶
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 NewConfigChangeWarning ¶
func NewValidationError ¶
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 ¶
Apply either creates new or modifies an existing cluster, based on the provided action.
func (*Cluster) ApplyNewConfig ¶
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 ¶
StoreNewConfig makes a copy of the provided (new) configuration file in cluster directory.
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)