defaults

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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 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 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

func FileNameForImage(img string) string

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

func PathToConfig(name string) string

PathToConfig calls PathToConfig on the default provider.

func PathToEmbeddedClusterBinary

func PathToEmbeddedClusterBinary(name string) string

PathToEmbeddedClusterBinary calls PathToEmbeddedClusterBinary on the default provider.

func PathToHelmChart

func PathToHelmChart(name string, version string) string

PathToHelmChart calls PathToHelmChart on the default provider.

func PathToK0sctlBinary

func PathToK0sctlBinary(name string) string

PathToK0sctlBinary calls PathToK0sctlBinary on the default provider.

func PathToLog

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.

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

func NewProvider(base string) *Provider

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

func (d *Provider) 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 (*Provider) ConfigSubDir

func (d *Provider) 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 (*Provider) DecentralizedInstall

func (d *Provider) 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 (*Provider) EmbeddedClusterBinsSubDir

func (d *Provider) EmbeddedClusterBinsSubDir() string

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

func (d *Provider) EmbeddedClusterLogsSubDir() string

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

func (d *Provider) 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 (*Provider) HelmChartSubDir

func (d *Provider) HelmChartSubDir() string

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

func (d *Provider) 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 (*Provider) K0sBinaryPath

func (d *Provider) K0sBinaryPath() string

K0sBinaryPath returns the path to the k0s binary.

func (*Provider) K0sctlApplyLogPath

func (d *Provider) K0sctlApplyLogPath() string

K0sctlApplyLogPath returns the path to the k0sctl apply log file.

func (*Provider) K0sctlBinsSubDir

func (d *Provider) 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 (*Provider) PathToConfig

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

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

func (*Provider) PathToEmbeddedClusterBinary

func (d *Provider) PathToEmbeddedClusterBinary(name string) string

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

func (d *Provider) PathToHelmChart(name string, version string) string

PathToHelmChart returns the path to a materialized helm chart.

func (*Provider) PathToK0sctlBinary

func (d *Provider) 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 (*Provider) PathToLog

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

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

func (*Provider) PreferredNodeIPAddress

func (d *Provider) 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 (*Provider) SSHAuthorizedKeysPath

func (d *Provider) SSHAuthorizedKeysPath() string

SSHAuthorizedKeysPath returns the path to the authorized_hosts file.

func (*Provider) SSHConfigSubDir

func (d *Provider) 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 (*Provider) SSHKeyPath

func (d *Provider) SSHKeyPath() string

SSHKeyPath returns the path to the SSH managed by embedded-cluster installation.

func (*Provider) SetInstallAsDecentralized

func (d *Provider) SetInstallAsDecentralized() error

SetInstallAsDecentralized sets the decentralized install flag inside the configuration directory.

func (*Provider) TryDiscoverPublicIP

func (d *Provider) TryDiscoverPublicIP() string

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.

Jump to

Keyboard shortcuts

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