Documentation
¶
Overview ¶
Package wsl enrolls the Windows Subsystem for Linux distro that runs on the same host as CasOS. It installs an SSH key into the distro so the machine can be managed exactly like a remote SSH machine, without asking the user for an IP address, port, username or password.
Index ¶
Constants ¶
const DefaultInstallDistro = "Ubuntu"
DefaultInstallDistro is the distribution CasOS installs when the host has no distro it can turn into a worker node. Ubuntu is the WSL default, it ships systemd support and apt, which is what the node deployment expects.
Variables ¶
This section is empty.
Functions ¶
func Available ¶
func Available() error
Available reports whether the local host can run WSL commands at all.
func EnsureSystemd ¶ added in v1.38.0
EnsureSystemd makes distro boot with systemd, which the kubelet and kube-proxy services require. It reports whether the distro had to be restarted, and only restarts one that was not running systemd already.
Types ¶
type Distro ¶ added in v1.38.0
type Distro struct {
Name string `json:"name"`
State string `json:"state"`
Version int `json:"version"`
Default bool `json:"default"`
}
Distro is one registered WSL distribution.
type ProvisionResult ¶
type ProvisionResult struct {
Distro string `json:"distro"`
Os string `json:"os"`
Username string `json:"username"`
Port int `json:"port"`
Hosts []string `json:"hosts"`
// Warnings holds non fatal problems, for example sshd that was already
// running. They are only interesting when the SSH check later fails.
Warnings []string `json:"warnings,omitempty"`
}
ProvisionResult describes the local WSL distro after sshd has been prepared.
func Provision ¶
func Provision(ctx context.Context, distro, publicKey string) (*ProvisionResult, error)
Provision makes sure sshd runs inside distro and authorizes publicKey for both the distro's login user and root. An empty distro means the default one. It returns the addresses the caller can use to reach the distro over SSH.
type Status ¶ added in v1.38.0
type Status struct {
CLIAvailable bool `json:"cliAvailable"`
Distros []Distro `json:"distros"`
// Detail carries what wsl.exe said when no distro could be listed, which is
// the only useful hint about why WSL is not usable yet.
Detail string `json:"detail,omitempty"`
}
Status describes the WSL installation of the local Windows host.
func Detect ¶ added in v1.38.0
Detect reports what WSL looks like on this host. A host without WSL is not an error: it is the state Install exists to fix.
func Install ¶ added in v1.38.0
Install registers distro, installing WSL itself first when the host does not have it yet. The distro is not launched, so its interactive first-run setup never asks the user for an account: CasOS only ever runs commands as root.
It returns the detected distros afterwards so the caller can tell an install that finished from one that needs Windows to restart first.
func (*Status) NodeDistro ¶ added in v1.38.0
NodeDistro returns the distro CasOS should enroll: the default one when it is usable, otherwise the first usable one.