bootstrapper

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2017 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BootstrapperTypeLocalkube = "localkube"
	BootstrapperTypeKubeadm   = "kubeadm"
)

Variables

This section is empty.

Functions

func GetCachedImageList added in v0.22.2

func GetCachedImageList(version string, bootstrapper string) []string

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

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

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
	DNSDomain         string
	ContainerRuntime  string
	NetworkPlugin     string
	FeatureGates      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

func NewSSHRunner(c *ssh.Client) *SSHRunner

NewSSHRunner returns a new SSHRunner that will run commands through the ssh.Client provided.

func (*SSHRunner) CombinedOutput

func (s *SSHRunner) CombinedOutput(cmd string) (string, error)

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.

func (*SSHRunner) Remove

func (s *SSHRunner) Remove(f assets.CopyableFile) error

Remove runs a command to delete a file on the remote.

func (*SSHRunner) Run

func (s *SSHRunner) Run(cmd string) error

Run starts a command on the remote and waits for it to return.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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