Documentation ¶
Index ¶
- Constants
- func GetCachedImageList(version string, bootstrapper string) []string
- func SetupCerts(cmd CommandRunner, k8s config.KubernetesConfig) error
- type Bootstrapper
- type CommandRunner
- type ExecRunner
- type FakeCommandRunner
- func (f *FakeCommandRunner) CombinedOutput(cmd string) (string, error)
- func (f *FakeCommandRunner) CombinedOutputTo(cmd string, out io.Writer) 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 SSHRunner
Constants ¶
const (
BootstrapperTypeKubeadm = "kubeadm"
)
Variables ¶
This section is empty.
Functions ¶
func GetCachedImageList ¶ added in v0.22.2
func SetupCerts ¶
func SetupCerts(cmd CommandRunner, k8s config.KubernetesConfig) error
SetupCerts gets the generated credentials required to talk to the APIServer.
Types ¶
type Bootstrapper ¶
type Bootstrapper interface { StartCluster(config.KubernetesConfig) error UpdateCluster(config.KubernetesConfig) error RestartCluster(config.KubernetesConfig) error GetClusterLogsTo(follow bool, out io.Writer) error SetupCerts(cfg config.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 // CombinedOutputTo runs the command and stores both command // output and error to out. A typical usage is: // // var b bytes.Buffer // CombinedOutput(cmd, &b) // fmt.Println(b.Bytes()) // // Or, you can set out to os.Stdout, the command output and // error would show on your terminal immediately before you // cmd exit. This is useful for a long run command such as // continuously print running logs. CombinedOutputTo(cmd string, out io.Writer) 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 (e *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) CombinedOutputTo ¶ added in v0.26.0
func (*ExecRunner) CombinedOutputTo(cmd string, out io.Writer) error
CombinedOutputTo runs the command and stores both command output and error to out.
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) CombinedOutputTo ¶ added in v0.26.0
func (f *FakeCommandRunner) CombinedOutputTo(cmd string, out io.Writer) error
CombinedOutputTo runs the command and stores both command output and error to out.
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 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) CombinedOutputTo ¶ added in v0.26.0
CombinedOutputTo runs the command and stores both command output and error to out.
func (*SSHRunner) Copy ¶
func (s *SSHRunner) Copy(f assets.CopyableFile) error
Copy copies a file to the remote over SSH.