platform

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 16, 2016 License: Apache-2.0 Imports: 33 Imported by: 22

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GCECreateImage

func GCECreateImage(api *compute.Service, proj, name, source string) error

Create image on GCE and and wait for completion. Will not overwrite existing image.

func GCECreateVM

func GCECreateVM(api *compute.Service, opts *GCEOptions, userdata string) (*gceMachine, error)

func GCEDestroyVM

func GCEDestroyVM(api *compute.Service, proj, zone, name string) error

func GCEForceCreateImage

func GCEForceCreateImage(api *compute.Service, proj, name, source string) error

Delete image on GCE and then recreate it.

func GCEListImages

func GCEListImages(client *http.Client, proj, prefix string) ([]string, error)

func InstallFile

func InstallFile(in io.Reader, m Machine, to string) error

InstallFile copies data from in to the path to on m.

func Manhole

func Manhole(m Machine) error

Manhole connects os.Stdin, os.Stdout, and os.Stderr to an interactive shell session on the Machine m. Manhole blocks until the shell session has ended. If os.Stdin does not refer to a TTY, Manhole returns immediately with a nil error.

func ReadFile added in v0.0.10

func ReadFile(m Machine, path string) (io.ReadCloser, error)

ReadFile returns a io.ReadCloser that streams the requested file. The caller should close the reader when finished.

func Reboot

func Reboot(m Machine) error

Reboots a machine and blocks until the system to be accessible by SSH again. It will return an error if the machine is not accessible after a timeout.

func StreamJournal

func StreamJournal(m Machine) error

StreamJournal streams the remote system's journal to stdout.

func TransferFile added in v0.0.10

func TransferFile(src Machine, srcPath string, dst Machine, dstPath string) error

Copy a file between two machines in a cluster.

Types

type AWSOptions

type AWSOptions struct {
	AMI           string
	InstanceType  string
	SecurityGroup string
	*Options
}

AWSOptions contains AWS-specific instance options.

type Cluster

type Cluster interface {
	// NewMachine creates a new CoreOS machine.
	NewMachine(config string) (Machine, error)

	// Machines returns a slice of the active machines in the Cluster.
	Machines() []Machine

	// GetDiscoveryURL returns a new etcd discovery URL.
	GetDiscoveryURL(size int) (string, error)

	// Destroy terminates each machine in the cluster and frees any other
	// associated resources.
	Destroy() error
}

Cluster represents a cluster of CoreOS machines within a single platform.

func NewAWSCluster

func NewAWSCluster(conf AWSOptions) (Cluster, error)

NewAWSCluster creates an instance of a Cluster suitable for spawning instances on Amazon Web Services' Elastic Compute platform.

NewAWSCluster will consume the environment variables $AWS_REGION, $AWS_ACCESS_KEY_ID, and $AWS_SECRET_ACCESS_KEY to determine the region to spawn instances in and the credentials to use to authenticate.

func NewGCECluster

func NewGCECluster(conf GCEOptions) (Cluster, error)

func NewQemuCluster

func NewQemuCluster(conf QEMUOptions) (Cluster, error)

NewQemuCluster creates a Cluster instance, suitable for running virtual machines in QEMU.

type Conf

type Conf struct {
	// contains filtered or unexported fields
}

Conf is a configuration for a CoreOS machine. It may be either a coreos-cloudconfig or an ignition configuration.

func NewConf

func NewConf(userdata string) (*Conf, error)

NewConf parses userdata and returns a new Conf. It returns an error if the userdata can't be parsed as a coreos-cloudinit or ignition configuration.

func (*Conf) CopyKeys

func (c *Conf) CopyKeys(keys []*agent.Key)

CopyKeys copies public keys from agent ag into the configuration to the appropriate configuration section for the core user.

func (*Conf) String

func (c *Conf) String() string

String returns the string representation of the userdata in Conf.

type GCEOptions

type GCEOptions struct {
	Image       string
	Project     string
	Zone        string
	MachineType string
	DiskType    string
	Network     string
	ServiceAuth bool
	*Options
}

type Machine

type Machine interface {
	// ID returns the plaform-specific machine identifier.
	ID() string

	// IP returns the machine's public IP.
	IP() string

	// PrivateIP returns the machine's private IP.
	PrivateIP() string

	// SSHClient establishes a new SSH connection to the machine.
	SSHClient() (*ssh.Client, error)

	// PasswordSSHClient establishes a new SSH connection using the provided credentials.
	PasswordSSHClient(user string, password string) (*ssh.Client, error)

	// SSH runs a single command over a new SSH connection.
	SSH(cmd string) ([]byte, error)

	// Destroy terminates the machine and frees associated resources.
	Destroy() error
}

Machine represents a CoreOS instance.

func GCEListVMs

func GCEListVMs(api *compute.Service, opts *GCEOptions, prefix string) ([]Machine, error)

func NewMachines

func NewMachines(c Cluster, userdatas []string) ([]Machine, error)

NewMachines spawns len(userdatas) instances in cluster c, with each instance passed the respective userdata.

type Options added in v0.1.4

type Options struct {
	BaseName string
}

Options contains the base options for all clusters.

type QEMUCluster

type QEMUCluster struct {
	*local.LocalCluster
	// contains filtered or unexported fields
}

QEMUCluster is a local cluster of QEMU-based virtual machines.

XXX: must be exported so that certain QEMU tests can access struct members through type assertions.

func (*QEMUCluster) Destroy

func (qc *QEMUCluster) Destroy() error

func (*QEMUCluster) GetDiscoveryURL

func (qc *QEMUCluster) GetDiscoveryURL(size int) (string, error)

overrides baseCluster.GetDiscoveryURL

func (QEMUCluster) Machines

func (bc QEMUCluster) Machines() []Machine

func (*QEMUCluster) NewMachine

func (qc *QEMUCluster) NewMachine(cfg string) (Machine, error)

func (QEMUCluster) PasswordSSHClient added in v0.1.4

func (bc QEMUCluster) PasswordSSHClient(ip string, user string, password string) (*ssh.Client, error)

func (QEMUCluster) SSH

func (bc QEMUCluster) SSH(m Machine, cmd string) ([]byte, error)

func (QEMUCluster) SSHClient

func (bc QEMUCluster) SSHClient(ip string) (*ssh.Client, error)

type QEMUOptions

type QEMUOptions struct {
	// DiskImage is the full path to the disk image to boot in QEMU.
	DiskImage string
	Board     string

	// BIOSImage is name of the BIOS file to pass to QEMU.
	// It can be a plain name, or a full path.
	BIOSImage string

	*Options
}

QEMUOptions contains QEMU-specific options for the cluster.

type TestCluster

type TestCluster struct {
	Name        string
	NativeFuncs []string
	Options     map[string]string
	Cluster
}

TestCluster embedds a Cluster to provide platform independant helper methods.

func (*TestCluster) DropFile

func (t *TestCluster) DropFile(localPath string) error

DropFile places file from localPath to ~/ on every machine in cluster

func (*TestCluster) ListNativeFunctions

func (t *TestCluster) ListNativeFunctions() []string

ListNativeFunctions returns a slice of function names that can be executed directly on machines in the cluster.

func (*TestCluster) RunNative

func (t *TestCluster) RunNative(funcName string, m Machine) error

RunNative runs a registered NativeFunc on a remote machine

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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