Documentation ¶
Index ¶
- Constants
- func GetCachedImageList(version string, bootstrapper string) []string
- func SetupCerts(cmd CommandRunner, k8s KubernetesConfig) error
- type Bootstrapper
- type CommandRunner
- type ExecRunner
- type FakeCommandRunner
- func (f *FakeCommandRunner) CombinedOutput(cmd string) (string, error)
- func (f *FakeCommandRunner) Copy(file assets.CopyableFile) error
- func (f *FakeCommandRunner) DumpMaps(w io.Writer)
- func (f *FakeCommandRunner) GetFileToContents(filename string) (string, error)
- func (f *FakeCommandRunner) Remove(file assets.CopyableFile) error
- func (f *FakeCommandRunner) Run(cmd string) error
- func (f *FakeCommandRunner) SetCommandToOutput(cmdToOutput map[string]string)
- func (f *FakeCommandRunner) SetFileToContents(fileToContents map[string]string)
- type KubernetesConfig
- type SSHRunner
Constants ¶
const ( BootstrapperTypeLocalkube = "localkube" BootstrapperTypeKubeadm = "kubeadm" )
Variables ¶
This section is empty.
Functions ¶
func GetCachedImageList ¶ added in v0.22.2
func SetupCerts ¶
func SetupCerts(cmd CommandRunner, k8s KubernetesConfig) error
SetupCerts gets the generated credentials required to talk to the APIServer.
Types ¶
type Bootstrapper ¶
type Bootstrapper interface { StartCluster(KubernetesConfig) error UpdateCluster(KubernetesConfig) error RestartCluster(KubernetesConfig) error GetClusterLogs(follow bool) (string, error) SetupCerts(cfg KubernetesConfig) error GetClusterStatus() (string, error) }
Bootstrapper contains all the methods needed to bootstrap a kubernetes cluster
type CommandRunner ¶
type CommandRunner interface { // Run starts the specified command and waits for it to complete. Run(cmd string) error // CombinedOutput runs the command and returns its combined standard // output and standard error. CombinedOutput(cmd string) (string, error) // Copy is a convenience method that runs a command to copy a file Copy(assets.CopyableFile) error //Remove is a convenience method that runs a command to remove a file Remove(assets.CopyableFile) error }
CommandRunner represents an interface to run commands.
type ExecRunner ¶
type ExecRunner struct{}
ExecRunner runs commands using the os/exec package.
It implements the CommandRunner interface.
func (*ExecRunner) CombinedOutput ¶
func (*ExecRunner) CombinedOutput(cmd string) (string, error)
CombinedOutput runs the command in a bash shell and returns its combined standard output and standard error.
func (*ExecRunner) Copy ¶
func (*ExecRunner) Copy(f assets.CopyableFile) error
Copy copies a file and its permissions
func (*ExecRunner) Remove ¶
func (e *ExecRunner) Remove(f assets.CopyableFile) error
Remove removes a file
func (*ExecRunner) Run ¶
func (*ExecRunner) Run(cmd string) error
Run starts the specified command in a bash shell and waits for it to complete.
type FakeCommandRunner ¶
type FakeCommandRunner struct {
// contains filtered or unexported fields
}
FakeCommandRunner mocks command output without running the Commands
It implements the CommandRunner interface and is used for testing.
func NewFakeCommandRunner ¶
func NewFakeCommandRunner() *FakeCommandRunner
NewFakeCommandRunner returns a new FakeCommandRunner
The expected output of commands should be set with SetCommandToOutput
func (*FakeCommandRunner) CombinedOutput ¶
func (f *FakeCommandRunner) CombinedOutput(cmd string) (string, error)
CombinedOutput returns the set output for a given command text.
func (*FakeCommandRunner) Copy ¶
func (f *FakeCommandRunner) Copy(file assets.CopyableFile) error
Copy adds the filename, file contents key value pair to the stored map.
func (*FakeCommandRunner) DumpMaps ¶
func (f *FakeCommandRunner) DumpMaps(w io.Writer)
DumpMaps prints out the list of stored commands and stored filenames.
func (*FakeCommandRunner) GetFileToContents ¶
func (f *FakeCommandRunner) GetFileToContents(filename string) (string, error)
SetFileToContents stores the file to contents map for the FakeCommandRunner
func (*FakeCommandRunner) Remove ¶
func (f *FakeCommandRunner) Remove(file assets.CopyableFile) error
Remove removes the filename, file contents key value pair from the stored map
func (*FakeCommandRunner) Run ¶
func (f *FakeCommandRunner) Run(cmd string) error
Run returns nil if output has been set for the given command text.
func (*FakeCommandRunner) SetCommandToOutput ¶
func (f *FakeCommandRunner) SetCommandToOutput(cmdToOutput map[string]string)
SetCommandToOutput stores the file to contents map for the FakeCommandRunner
func (*FakeCommandRunner) SetFileToContents ¶
func (f *FakeCommandRunner) SetFileToContents(fileToContents map[string]string)
SetFileToContents stores the file to contents map for the FakeCommandRunner
type KubernetesConfig ¶
type KubernetesConfig struct { KubernetesVersion string NodeIP string NodeName string APIServerName string APIServerNames []string APIServerIPs []net.IP DNSDomain string ContainerRuntime string NetworkPlugin string FeatureGates string ServiceCIDR string ExtraOptions util.ExtraOptionSlice ShouldLoadCachedImages bool }
KubernetesConfig contains the parameters used to configure the VM Kubernetes.
type SSHRunner ¶
type SSHRunner struct {
// contains filtered or unexported fields
}
SSHRunner runs commands through SSH.
It implements the CommandRunner interface.
func NewSSHRunner ¶
NewSSHRunner returns a new SSHRunner that will run commands through the ssh.Client provided.
func (*SSHRunner) CombinedOutput ¶
CombinedOutput runs the command on the remote and returns its combined standard output and standard error.
func (*SSHRunner) Copy ¶
func (s *SSHRunner) Copy(f assets.CopyableFile) error
Copy copies a file to the remote over SSH.