Documentation ¶
Overview ¶
Package defaults holds default values for the embedded-cluster 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 ¶
- Variables
- func BinaryName() string
- func ConfigSubDir() string
- func DecentralizedInstall() bool
- func EmbeddedClusterBinsSubDir() string
- func EmbeddedClusterLogsSubDir() string
- func FileNameForImage(img string) string
- func HelmChartSubDir() string
- func IsUpgrade() bool
- func K0sBinaryPath() string
- func K0sctlApplyLogPath() string
- func K0sctlBinsSubDir() string
- func PathToConfig(name string) string
- func PathToEmbeddedClusterBinary(name string) string
- func PathToHelmChart(name string, version string) string
- func PathToK0sctlBinary(name string) string
- func PathToLog(name string) string
- func PreferredNodeIPAddress() (string, error)
- func SSHAuthorizedKeysPath() string
- func SSHKeyPath() string
- func SetInstallAsDecentralized() error
- func TryDiscoverPublicIP() string
- type Provider
- func (d *Provider) BinaryName() string
- func (d *Provider) ConfigSubDir() string
- func (d *Provider) DecentralizedInstall() bool
- func (d *Provider) EmbeddedClusterBinsSubDir() string
- func (d *Provider) EmbeddedClusterLogsSubDir() string
- func (d *Provider) FileNameForImage(img string) string
- func (d *Provider) HelmChartSubDir() string
- func (d *Provider) Init()
- func (d *Provider) IsUpgrade() bool
- func (d *Provider) K0sBinaryPath() string
- func (d *Provider) K0sctlApplyLogPath() string
- func (d *Provider) K0sctlBinsSubDir() string
- func (d *Provider) PathToConfig(name string) string
- func (d *Provider) PathToEmbeddedClusterBinary(name string) string
- func (d *Provider) PathToHelmChart(name string, version string) string
- func (d *Provider) PathToK0sctlBinary(name string) string
- func (d *Provider) PathToLog(name string) string
- func (d *Provider) PreferredNodeIPAddress() (string, error)
- func (d *Provider) SSHAuthorizedKeysPath() string
- func (d *Provider) SSHConfigSubDir() string
- func (d *Provider) SSHKeyPath() string
- func (d *Provider) SetInstallAsDecentralized() error
- func (d *Provider) TryDiscoverPublicIP() string
Constants ¶
This section is empty.
Variables ¶
var ( // Version holds the EmbeddedCluster 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 ConfigSubDir ¶
func ConfigSubDir() string
ConfigSubDir calls ConfigSubDir on the default provider.
func DecentralizedInstall ¶
func DecentralizedInstall() bool
DecentralizedInstall calls DecentralizedInstall on the default provider.
func EmbeddedClusterBinsSubDir ¶
func EmbeddedClusterBinsSubDir() string
EmbeddedClusterBinsSubDir calls EmbeddedClusterBinsSubDir on the default provider.
func EmbeddedClusterLogsSubDir ¶
func EmbeddedClusterLogsSubDir() string
EmbeddedClusterLogsSubDir calls EmbeddedClusterLogsSubDir on the default provider.
func FileNameForImage ¶
FileNameForImage calls FileNameForImage on the default provider.
func HelmChartSubDir ¶
func HelmChartSubDir() string
HelmChartSubDir calls HelmChartSubDir on the default provider.
func IsUpgrade ¶
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 ¶
PathToConfig calls PathToConfig on the default provider.
func PathToEmbeddedClusterBinary ¶
PathToEmbeddedClusterBinary calls PathToEmbeddedClusterBinary on the default provider.
func PathToHelmChart ¶
PathToHelmChart calls PathToHelmChart on the default provider.
func PathToK0sctlBinary ¶
PathToK0sctlBinary calls PathToK0sctlBinary on the default provider.
func PreferredNodeIPAddress ¶
PreferredNodeIPAddress calls PreferredNodeIPAddress on the default provider.
func SSHAuthorizedKeysPath ¶
func SSHAuthorizedKeysPath() string
SSHAuthorizedKeysPath calls SSHAuthorizedKeysPath on the default provider.
func SetInstallAsDecentralized ¶
func SetInstallAsDecentralized() error
SetInstallAsDecentralized calls SetInstallAsDecentralized on the default provider.
func TryDiscoverPublicIP ¶
func TryDiscoverPublicIP() string
TryDiscoverPublicIP calls TryDiscoverPublicIP on the default provider.
Types ¶
type Provider ¶
type Provider struct {
Base string
}
Provider is an entity that provides default values used during EmbeddedCluster installation.
func NewProvider ¶
NewProvider returns a new Provider using the provided base dir. Base is the base directory inside which all the other directories are created.
func (*Provider) BinaryName ¶
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 (*Provider) ConfigSubDir ¶
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 (*Provider) DecentralizedInstall ¶
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 (*Provider) EmbeddedClusterBinsSubDir ¶
EmbeddedClusterBinsSubDir returns the path to the directory where embedded-cluster binaries are stored. This is a subdirectory of the user's home directory.
func (*Provider) EmbeddedClusterLogsSubDir ¶
EmbeddedClusterLogsSubDir returns the path to the directory where embedded-cluster logs are stored. This is a subdirectory of the user's home directory.
func (*Provider) FileNameForImage ¶
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 (*Provider) HelmChartSubDir ¶
HelmChartSubDir returns the path to the directory where helm charts are stored
func (*Provider) Init ¶
func (d *Provider) Init()
Init makes sure all the necessary directory exists on the system.
func (*Provider) IsUpgrade ¶
IsUpgrade determines if we are upgrading a cluster judging by the existence or not of a kubeconfig file in the configuration directory.
func (*Provider) K0sBinaryPath ¶
K0sBinaryPath returns the path to the k0s binary.
func (*Provider) K0sctlApplyLogPath ¶
K0sctlApplyLogPath returns the path to the k0sctl apply log file.
func (*Provider) K0sctlBinsSubDir ¶
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 (*Provider) PathToConfig ¶
PathToConfig returns the full path to a configuration file. This function does not check if the file exists.
func (*Provider) PathToEmbeddedClusterBinary ¶
PathToEmbeddedClusterBinary is an utility function that returns the full path to a materialized binary that belongs to embedded-cluster (do not confuse with binaries belonging to k0sctl). This function does not check if the file exists.
func (*Provider) PathToHelmChart ¶
PathToHelmChart returns the path to a materialized helm chart.
func (*Provider) PathToK0sctlBinary ¶
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 (*Provider) PathToLog ¶
PathToLog returns the full path to a log file. This function does not check if the file exists.
func (*Provider) PreferredNodeIPAddress ¶
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 (*Provider) SSHAuthorizedKeysPath ¶
SSHAuthorizedKeysPath returns the path to the authorized_hosts file.
func (*Provider) SSHConfigSubDir ¶
SSHConfigSubDir returns the path to the directory where SSH configuration files are stored. This is a subdirectory of the user's home directory.
func (*Provider) SSHKeyPath ¶
SSHKeyPath returns the path to the SSH managed by embedded-cluster installation.
func (*Provider) SetInstallAsDecentralized ¶
SetInstallAsDecentralized sets the decentralized install flag inside the configuration directory.
func (*Provider) TryDiscoverPublicIP ¶
TryDiscoverPublicIP tries to discover the public IP of the node by querying a list of known providers. If the public IP cannot be discovered, an empty string is returned.