Documentation
¶
Index ¶
- type BaseWindows
- func (w *BaseWindows) Arch(h os.Host) (string, error)
- func (w *BaseWindows) Base(path string) string
- func (w *BaseWindows) Chown(h os.Host, path, owner string, _ ...exec.Option) error
- func (w *BaseWindows) DataDirDefaultPath() string
- func (w *BaseWindows) DeleteDir(h os.Host, path string, opts ...exec.Option) error
- func (w *BaseWindows) Dir(path string) string
- func (w *BaseWindows) DownloadURL(h os.Host, url, destination string, opts ...exec.Option) error
- func (w *BaseWindows) FileContains(h os.Host, path, s string) bool
- func (w *BaseWindows) HTTPStatus(h os.Host, url string) (int, error)
- func (w *BaseWindows) HostPath(path string) string
- func (w *BaseWindows) Hostname(h os.Host) string
- func (w *BaseWindows) K0sBinaryPath() string
- func (w *BaseWindows) K0sCmdf(template string, args ...interface{}) string
- func (w *BaseWindows) K0sConfigPath() string
- func (w *BaseWindows) K0sJoinTokenPath() string
- func (w *BaseWindows) K0sctlLockFilePath(h os.Host) string
- func (w *BaseWindows) KubeconfigPath(h os.Host, dataDir string) string
- func (w *BaseWindows) KubectlCmdf(h os.Host, dataDir, s string, args ...interface{}) string
- func (w *BaseWindows) LookPath(h os.Host, file string) (string, error)
- func (w *BaseWindows) MachineID(h os.Host) (string, error)
- func (w *BaseWindows) MoveFile(h os.Host, src, dst string) error
- func (w *BaseWindows) OSKind() string
- func (w *BaseWindows) PrivateAddress(h os.Host, iface, publicip string) (string, error)
- func (w *BaseWindows) PrivateInterface(h os.Host) (string, error)
- func (w *BaseWindows) Quote(value string) string
- func (w *BaseWindows) ReplaceK0sTokenPath(h os.Host, spath string) error
- func (w *BaseWindows) SetPath(key, value string)
- func (w *BaseWindows) SystemTime(h os.Host) (time.Time, error)
- func (w *BaseWindows) TempDir(h os.Host) (string, error)
- func (w *BaseWindows) TempFile(h os.Host) (string, error)
- func (w *BaseWindows) UpsertFile(h os.Host, path, content string) error
- type Configurer
- type HostValidator
- type Linux
- func (l *Linux) Arch(h os.Host) (string, error)
- func (l *Linux) Base(p string) string
- func (l *Linux) Chown(h os.Host, path, owner string, opts ...exec.Option) error
- func (l *Linux) DataDirDefaultPath() string
- func (l *Linux) DeleteDir(h os.Host, path string, opts ...exec.Option) error
- func (l *Linux) Dir(p string) string
- func (l *Linux) DownloadURL(h os.Host, url, destination string, opts ...exec.Option) error
- func (l *Linux) FileContains(h os.Host, path, s string) bool
- func (l *Linux) HTTPStatus(h os.Host, url string) (int, error)
- func (l *Linux) HostPath(p string) string
- func (l *Linux) K0sBinaryPath() string
- func (l *Linux) K0sCmdf(template string, args ...any) string
- func (l *Linux) K0sConfigPath() string
- func (l *Linux) K0sJoinTokenPath() string
- func (l *Linux) K0sctlLockFilePath(h os.Host) string
- func (l *Linux) KubeconfigPath(h os.Host, dataDir string) string
- func (l *Linux) KubectlCmdf(h os.Host, dataDir, s string, args ...any) string
- func (l *Linux) LookPath(h os.Host, file string) (string, error)
- func (l *Linux) MachineID(h os.Host) (string, error)
- func (l *Linux) MoveFile(h os.Host, src, dst string) error
- func (l *Linux) OSKind() string
- func (l *Linux) PrivateAddress(h os.Host, iface, publicip string) (string, error)
- func (l *Linux) PrivateInterface(h os.Host) (string, error)
- func (l *Linux) Quote(value string) string
- func (l *Linux) ReplaceK0sTokenPath(h os.Host, spath string) error
- func (l *Linux) SetPath(key, value string)
- func (l *Linux) SystemTime(h os.Host) (time.Time, error)
- func (l *Linux) TempDir(h os.Host) (string, error)
- func (l *Linux) TempFile(h os.Host) (string, error)
- func (l *Linux) UpsertFile(h os.Host, path, content string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseWindows ¶ added in v0.29.0
type BaseWindows struct {
// contains filtered or unexported fields
}
Windows provides helpers and defaults for Windows hosts
func (*BaseWindows) Arch ¶ added in v0.29.0
func (w *BaseWindows) Arch(h os.Host) (string, error)
Arch returns the host processor architecture in the format k0s expects it
func (*BaseWindows) Base ¶ added in v0.29.0
func (w *BaseWindows) Base(path string) string
Base returns the last element of a path
func (*BaseWindows) Chown ¶ added in v0.29.0
Chown is a no-op on Windows; ownership semantics differ and are not managed here
func (*BaseWindows) DataDirDefaultPath ¶ added in v0.29.0
func (w *BaseWindows) DataDirDefaultPath() string
DataDirDefaultPath returns the path to the k0s data dir on the host
func (*BaseWindows) Dir ¶ added in v0.29.0
func (w *BaseWindows) Dir(path string) string
Dir returns the directory part of a path
func (*BaseWindows) DownloadURL ¶ added in v0.29.0
DownloadURL performs a download from a URL on the host
func (*BaseWindows) FileContains ¶ added in v0.29.0
func (w *BaseWindows) FileContains(h os.Host, path, s string) bool
FileContains returns true if a file contains the substring
func (*BaseWindows) HTTPStatus ¶ added in v0.29.0
HTTPStatus makes a HTTP GET request to the url and returns the status code or an error
func (*BaseWindows) HostPath ¶ added in v0.29.0
func (w *BaseWindows) HostPath(path string) string
HostPath converts the provided path to a native Windows path representation
func (*BaseWindows) Hostname ¶ added in v0.29.0
func (w *BaseWindows) Hostname(h os.Host) string
Hostname on windows returns the hostname
func (*BaseWindows) K0sBinaryPath ¶ added in v0.29.0
func (w *BaseWindows) K0sBinaryPath() string
K0sBinaryPath returns the path to the k0s binary on the host
func (*BaseWindows) K0sCmdf ¶ added in v0.29.0
func (w *BaseWindows) K0sCmdf(template string, args ...interface{}) string
K0sCmdf can be used to construct k0s commands in sprintf style.
func (*BaseWindows) K0sConfigPath ¶ added in v0.29.0
func (w *BaseWindows) K0sConfigPath() string
K0sConfigPath returns the path to the k0s config file on the host
func (*BaseWindows) K0sJoinTokenPath ¶ added in v0.29.0
func (w *BaseWindows) K0sJoinTokenPath() string
K0sJoinTokenPath returns the path to the k0s join token file on the host
func (*BaseWindows) K0sctlLockFilePath ¶ added in v0.29.0
func (w *BaseWindows) K0sctlLockFilePath(h os.Host) string
K0sctlLockFilePath returns a path to a lock file
func (*BaseWindows) KubeconfigPath ¶ added in v0.29.0
func (w *BaseWindows) KubeconfigPath(h os.Host, dataDir string) string
KubeconfigPath returns the path to a kubeconfig on the host
func (*BaseWindows) KubectlCmdf ¶ added in v0.29.0
func (w *BaseWindows) KubectlCmdf(h os.Host, dataDir, s string, args ...interface{}) string
KubectlCmdf returns a command line in sprintf manner for running kubectl on the host using the kubeconfig from KubeconfigPath
func (*BaseWindows) LookPath ¶ added in v0.29.0
LookPath resolves a binary path on the remote Windows host similarly to exec.LookPath
func (*BaseWindows) MachineID ¶ added in v0.29.0
func (w *BaseWindows) MachineID(h os.Host) (string, error)
func (*BaseWindows) MoveFile ¶ added in v0.29.0
func (w *BaseWindows) MoveFile(h os.Host, src, dst string) error
MoveFile moves a file on the host
func (*BaseWindows) OSKind ¶ added in v0.29.0
func (w *BaseWindows) OSKind() string
OSKind returns the identifier for Windows hosts
func (*BaseWindows) PrivateAddress ¶ added in v0.29.0
PrivateAddress resolves internal ip from private interface (not implemented for Windows yet)
func (*BaseWindows) PrivateInterface ¶ added in v0.29.0
func (w *BaseWindows) PrivateInterface(h os.Host) (string, error)
PrivateInterface tries to find a private network interface (not implemented for Windows yet)
func (*BaseWindows) Quote ¶ added in v0.29.0
func (w *BaseWindows) Quote(value string) string
func (*BaseWindows) ReplaceK0sTokenPath ¶ added in v0.29.0
func (w *BaseWindows) ReplaceK0sTokenPath(h os.Host, spath string) error
ReplaceK0sTokenPath replaces the config path in the service stub
func (*BaseWindows) SetPath ¶ added in v0.29.0
func (w *BaseWindows) SetPath(key, value string)
SetPath sets a path for a key
func (*BaseWindows) SystemTime ¶ added in v0.29.0
SystemTime returns the system time as UTC reported by the OS or an error if this fails
func (*BaseWindows) TempDir ¶ added in v0.29.0
func (w *BaseWindows) TempDir(h os.Host) (string, error)
TempDir returns a temp dir path
func (*BaseWindows) TempFile ¶ added in v0.29.0
func (w *BaseWindows) TempFile(h os.Host) (string, error)
TempFile returns a temp file path
func (*BaseWindows) UpsertFile ¶ added in v0.29.0
func (w *BaseWindows) UpsertFile(h os.Host, path, content string) error
UpsertFile creates a file in path with content only if the file does not exist already
type Configurer ¶ added in v0.29.0
type Configurer interface {
Kind() string
OSKind() string
Quote(string) string
CheckPrivilege(os.Host) error
StartService(os.Host, string) error
StopService(os.Host, string) error
RestartService(os.Host, string) error
ServiceIsRunning(os.Host, string) bool
Arch(os.Host) (string, error)
K0sCmdf(string, ...interface{}) string
K0sBinaryPath() string
K0sConfigPath() string
DataDirDefaultPath() string
K0sJoinTokenPath() string
WriteFile(os.Host, string, string, string) error
UpdateEnvironment(os.Host, map[string]string) error
DaemonReload(os.Host) error
ReplaceK0sTokenPath(os.Host, string) error
ServiceScriptPath(os.Host, string) (string, error)
ReadFile(os.Host, string) (string, error)
FileExist(os.Host, string) bool
Chmod(os.Host, string, string, ...exec.Option) error
Chown(os.Host, string, string, ...exec.Option) error
DownloadURL(os.Host, string, string, ...exec.Option) error
InstallPackage(os.Host, ...string) error
FileContains(os.Host, string, string) bool
MoveFile(os.Host, string, string) error
MkDir(os.Host, string, ...exec.Option) error
DeleteFile(os.Host, string) error
CommandExist(os.Host, string) bool
Hostname(os.Host) string
KubectlCmdf(os.Host, string, string, ...interface{}) string
KubeconfigPath(os.Host, string) string
IsContainer(os.Host) bool
FixContainer(os.Host) error
HTTPStatus(os.Host, string) (int, error)
PrivateInterface(os.Host) (string, error)
PrivateAddress(os.Host, string, string) (string, error)
TempDir(os.Host) (string, error)
TempFile(os.Host) (string, error)
UpdateServiceEnvironment(os.Host, string, map[string]string) error
CleanupServiceEnvironment(os.Host, string) error
Stat(os.Host, string, ...exec.Option) (*os.FileInfo, error)
DeleteDir(os.Host, string, ...exec.Option) error
K0sctlLockFilePath(os.Host) string
UpsertFile(os.Host, string, string) error
MachineID(os.Host) (string, error)
SetPath(string, string)
SystemTime(os.Host) (time.Time, error)
Touch(os.Host, string, time.Time, ...exec.Option) error
Dir(string) string
Base(string) string
HostPath(string) string
LookPath(os.Host, string) (string, error)
}
Configurer defines the per-host operations required for managing a host.
type HostValidator ¶ added in v0.29.0
HostValidator allows a Configurer to implement host-specific validation logic.
type Linux ¶
type Linux struct {
// contains filtered or unexported fields
}
Linux is a base module for various linux OS support packages
func (*Linux) DataDirDefaultPath ¶ added in v0.15.1
DataDirDefaultPath returns the path to the k0s data dir on the host
func (*Linux) DownloadURL ¶ added in v0.12.0
DownloadURL performs a download from a URL on the host
func (*Linux) FileContains ¶
FileContains returns true if a file contains the substring
func (*Linux) HTTPStatus ¶
HTTPStatus makes a HTTP GET request to the url and returns the status code or an error
func (*Linux) K0sBinaryPath ¶
K0sBinaryPath returns the path to the k0s binary on the host
func (*Linux) K0sConfigPath ¶
K0sConfigPath returns the path to the k0s config file on the host
func (*Linux) K0sJoinTokenPath ¶
K0sJoinTokenPath returns the path to the k0s join token file on the host
func (*Linux) K0sctlLockFilePath ¶ added in v0.13.0
K0sctlLockFilePath returns a path to a lock file
func (*Linux) KubeconfigPath ¶
KubeconfigPath returns the path to a kubeconfig on the host
func (*Linux) KubectlCmdf ¶
KubectlCmdf returns a command line in sprintf manner for running kubectl on the host using the kubeconfig from KubeconfigPath
func (*Linux) LookPath ¶ added in v0.29.0
LookPath behaves similarly to exec.LookPath but resolves the binary on the remote host
func (*Linux) PrivateAddress ¶
PrivateAddress resolves internal ip from private interface
func (*Linux) PrivateInterface ¶
PrivateInterface tries to find a private network interface
func (*Linux) Quote ¶ added in v0.29.0
Quote wraps shellescape.Quote for consumers that need OS-aware escaping
func (*Linux) ReplaceK0sTokenPath ¶
ReplaceK0sTokenPath replaces the config path in the service stub
func (*Linux) SystemTime ¶ added in v0.24.0
SystemTime returns the system time as UTC reported by the OS or an error if this fails