defaults

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package defaults holds default values for the helmvm binary. For sake of keeping everything simple this packages exits(1) if some error occurs as these should not happen in the first place.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version holds the HelmVM version.
	Version = "v0.0.0"
	// K0sVersion holds the version of k0s binary we are embedding. this is
	// set at compile time via ldflags.
	K0sVersion = "0.0.0"
)

Functions

func BinaryName

func BinaryName() string

BinaryName calls BinaryName on the default provider.

func ConfigSubDir

func ConfigSubDir() string

ConfigSubDir calls ConfigSubDir on the default provider.

func DecentralizedInstall

func DecentralizedInstall() bool

DecentralizedInstall calls DecentralizedInstall on the default provider.

func FileNameForImage

func FileNameForImage(img string) string

FileNameForImage calls FileNameForImage on the default provider.

func HelmVMBinsSubDir

func HelmVMBinsSubDir() string

HelmVMBinsSubDir calls HelmVMBinsSubDir on the default provider.

func HelmVMLogsSubDir added in v0.6.0

func HelmVMLogsSubDir() string

HelmVMLogsSubDir calls HelmVMLogsSubDir on the default provider.

func IsUpgrade added in v0.9.0

func IsUpgrade() bool

IsUpgrade determines if we are upgrading a cluster judging by the existence or not of a kubeconfig file in the configuration directory.

func K0sBinaryPath

func K0sBinaryPath() string

K0sBinaryPath calls K0sBinaryPath on the default provider.

func K0sctlApplyLogPath

func K0sctlApplyLogPath() string

K0sctlApplyLogPath calls K0sctlApplyLogPath on the default provider.

func K0sctlBinsSubDir

func K0sctlBinsSubDir() string

K0sctlBinsSubDir calls K0sctlBinsSubDir on the default provider.

func PathToConfig

func PathToConfig(name string) string

PathToConfig calls PathToConfig on the default provider.

func PathToHelmVMBinary

func PathToHelmVMBinary(name string) string

PathToHelmVMBinary calls PathToHelmVMBinary on the default provider.

func PathToK0sctlBinary

func PathToK0sctlBinary(name string) string

PathToK0sctlBinary calls PathToK0sctlBinary on the default provider.

func PathToLog added in v0.6.0

func PathToLog(name string) string

PathToLog calls PathToLog on the default provider.

func PreferredNodeIPAddress

func PreferredNodeIPAddress() (string, error)

PreferredNodeIPAddress calls PreferredNodeIPAddress on the default provider.

func SSHAuthorizedKeysPath

func SSHAuthorizedKeysPath() string

SSHAuthorizedKeysPath calls SSHAuthorizedKeysPath on the default provider.

func SSHKeyPath

func SSHKeyPath() string

SSHKeyPath calls SSHKeyPath on the default provider.

func SetInstallAsDecentralized

func SetInstallAsDecentralized() error

SetInstallAsDecentralized calls SetInstallAsDecentralized on the default provider.

Types

type DefaultsProvider added in v0.6.0

type DefaultsProvider struct {
	Base string
}

DefaultsProvider is an entity that provides default values used during HelmVM installation.

func NewProvider added in v0.6.0

func NewProvider(base string) *DefaultsProvider

NewProvider returns a new DefaultsProvider using the provided base dir. Base is the base directory inside which all the other directories are created.

func (*DefaultsProvider) BinaryName added in v0.6.0

func (d *DefaultsProvider) BinaryName() string

BinaryName returns the binary name, this is useful for places where we need to present the name of the binary to the user (the name may vary if the binary is renamed). We make sure the name does not contain invalid characters for a filename.

func (*DefaultsProvider) ConfigSubDir added in v0.6.0

func (d *DefaultsProvider) ConfigSubDir() string

ConfigSubDir returns the path to the directory where k0sctl configuration files are stored. This is a subdirectory of the user's home directory. TODO update

func (*DefaultsProvider) DecentralizedInstall added in v0.6.0

func (d *DefaultsProvider) DecentralizedInstall() bool

DecentralizedInstall returns true if the cluster installation has been executed in a decentralized way (installing the first node then generating a join token and installing the others).

func (*DefaultsProvider) FileNameForImage added in v0.6.0

func (d *DefaultsProvider) FileNameForImage(img string) string

FileNameForImage returns an appropriate .tar name for a given image. e.g. quay.io/test/test:v1 would return quay.io-test-test-v1.tar.

func (*DefaultsProvider) HelmVMBinsSubDir added in v0.6.0

func (d *DefaultsProvider) HelmVMBinsSubDir() string

HelmVMBinsSubDir returns the path to the directory where helmvm binaries are stored. This is a subdirectory of the user's home directory.

func (*DefaultsProvider) HelmVMLogsSubDir added in v0.6.0

func (d *DefaultsProvider) HelmVMLogsSubDir() string

HelmVMLogsSubDir returns the path to the directory where helmvm logs are stored. This is a subdirectory of the user's home directory.

func (*DefaultsProvider) Init added in v0.6.0

func (d *DefaultsProvider) Init()

Init makes sure all the necessary directory exists on the system.

func (*DefaultsProvider) IsUpgrade added in v0.9.0

func (d *DefaultsProvider) IsUpgrade() bool

IsUpgrade determines if we are upgrading a cluster judging by the existence or not of a kubeconfig file in the configuration directory.

func (*DefaultsProvider) K0sBinaryPath added in v0.6.0

func (d *DefaultsProvider) K0sBinaryPath() string

K0sBinaryPath returns the path to the k0s binary.

func (*DefaultsProvider) K0sctlApplyLogPath added in v0.6.0

func (d *DefaultsProvider) K0sctlApplyLogPath() string

K0sctlApplyLogPath returns the path to the k0sctl apply log file.

func (*DefaultsProvider) K0sctlBinsSubDir added in v0.6.0

func (d *DefaultsProvider) K0sctlBinsSubDir() string

K0sctlBinsSubDir returns the path to the directory where k0sctl binaries are stored. This is a subdirectory of the user's home directory. Follows the k0sctl directory convention.

func (*DefaultsProvider) PathToConfig added in v0.6.0

func (d *DefaultsProvider) PathToConfig(name string) string

PathToConfig returns the full path to a configuration file. This function does not check if the file exists.

func (*DefaultsProvider) PathToHelmVMBinary added in v0.6.0

func (d *DefaultsProvider) PathToHelmVMBinary(name string) string

PathToHelmVMBinary is an utility function that returns the full path to a materialized binary that belongs to helmvm (do not confuse with binaries belonging to k0sctl). This function does not check if the file exists.

func (*DefaultsProvider) PathToK0sctlBinary added in v0.6.0

func (d *DefaultsProvider) PathToK0sctlBinary(name string) string

PathToK0sctlBinary is an utility function that returns the full path to a materialized binary that belongs to k0sctl. This function does not check if the file exists.

func (*DefaultsProvider) PathToLog added in v0.6.0

func (d *DefaultsProvider) PathToLog(name string) string

PathToLog returns the full path to a log file. This function does not check if the file exists.

func (*DefaultsProvider) PreferredNodeIPAddress added in v0.6.0

func (d *DefaultsProvider) PreferredNodeIPAddress() (string, error)

PreferredNodeIPAddress returns the ip address the node uses when reaching the internet. This is useful when the node has multiple interfaces and we want to bind to one of the interfaces.

func (*DefaultsProvider) SSHAuthorizedKeysPath added in v0.6.0

func (d *DefaultsProvider) SSHAuthorizedKeysPath() string

SSHAuthorizedKeysPath returns the path to the authorized_hosts file.

func (*DefaultsProvider) SSHConfigSubDir added in v0.6.0

func (d *DefaultsProvider) SSHConfigSubDir() string

SSHConfigSubDir returns the path to the directory where SSH configuration files are stored. This is a subdirectory of the user's home directory.

func (*DefaultsProvider) SSHKeyPath added in v0.6.0

func (d *DefaultsProvider) SSHKeyPath() string

SSHKeyPath returns the path to the SSH managed by helmvm installation.

func (*DefaultsProvider) SetInstallAsDecentralized added in v0.6.0

func (d *DefaultsProvider) SetInstallAsDecentralized() error

SetInstallAsDecentralized sets the decentralized install flag inside the configuration directory.

Jump to

Keyboard shortcuts

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