Documentation ¶
Index ¶
- func CheckMachine(ctx context.Context, m Machine) error
- func EnableSelinux(m Machine) error
- func InstallFile(in io.Reader, m Machine, to string) error
- func Manhole(m Machine) error
- func ReadFile(m Machine, path string) (io.ReadCloser, error)
- func RebootMachine(m Machine, j *Journal) error
- func StartMachine(m Machine, j *Journal) error
- func StartReboot(m Machine) error
- func TransferFile(src Machine, srcPath string, dst Machine, dstPath string) error
- type BaseCluster
- func (bc *BaseCluster) AddMach(m Machine)
- func (bc *BaseCluster) ConsoleOutput() map[string]string
- func (bc *BaseCluster) DelMach(m Machine)
- func (bc *BaseCluster) Destroy()
- func (bc *BaseCluster) GetDiscoveryURL(size int) (string, error)
- func (bc *BaseCluster) Keys() ([]*agent.Key, error)
- func (bc *BaseCluster) Machines() []Machine
- func (bc *BaseCluster) Name() string
- func (bc *BaseCluster) PasswordSSHClient(ip string, user string, password string) (*ssh.Client, error)
- func (bc *BaseCluster) Platform() Name
- func (bc *BaseCluster) RenderUserData(userdata *conf.UserData, ignitionVars map[string]string) (*conf.Conf, error)
- func (bc *BaseCluster) RuntimeConf() RuntimeConfig
- func (bc *BaseCluster) SSH(m Machine, cmd string) ([]byte, []byte, error)
- func (bc *BaseCluster) SSHClient(ip string) (*ssh.Client, error)
- func (bc *BaseCluster) UserSSHClient(ip, user string) (*ssh.Client, error)
- type Cluster
- type Journal
- type Machine
- type Name
- type Options
- type RuntimeConfig
- type SystemdDropin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckMachine ¶ added in v0.2.0
CheckMachine tests a machine for various error conditions such as ssh being available and no systemd units failing at the time ssh is reachable. It also ensures the remote system is running Container Linux by CoreOS.
TODO(mischief): better error messages.
func EnableSelinux ¶ added in v0.2.0
Enable SELinux on a machine (skip on machines without SELinux support)
func InstallFile ¶
InstallFile copies data from in to the path to on m.
func Manhole ¶
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 RebootMachine ¶ added in v0.7.0
RebootMachine will reboot a given machine, provided the machine's journal.
func StartMachine ¶ added in v0.7.0
StartMachine will start a given machine, provided the machine's journal.
func StartReboot ¶ added in v0.3.0
Reboots a machine, stopping ssh first. Afterwards run CheckMachine to verify the system is back and operational.
Types ¶
type BaseCluster ¶ added in v0.2.0
type BaseCluster struct {
// contains filtered or unexported fields
}
func NewBaseCluster ¶ added in v0.2.0
func NewBaseCluster(opts *Options, rconf *RuntimeConfig, platform Name, ctPlatform string) (*BaseCluster, error)
func NewBaseClusterWithDialer ¶ added in v0.2.0
func NewBaseClusterWithDialer(opts *Options, rconf *RuntimeConfig, platform Name, ctPlatform string, dialer network.Dialer) (*BaseCluster, error)
func (*BaseCluster) AddMach ¶ added in v0.2.0
func (bc *BaseCluster) AddMach(m Machine)
func (*BaseCluster) ConsoleOutput ¶ added in v0.6.0
func (bc *BaseCluster) ConsoleOutput() map[string]string
func (*BaseCluster) DelMach ¶ added in v0.2.0
func (bc *BaseCluster) DelMach(m Machine)
func (*BaseCluster) Destroy ¶ added in v0.2.0
func (bc *BaseCluster) Destroy()
Destroy destroys each machine in the cluster and closes the SSH agent.
func (*BaseCluster) GetDiscoveryURL ¶ added in v0.2.0
func (bc *BaseCluster) GetDiscoveryURL(size int) (string, error)
XXX(mischief): i don't really think this belongs here, but it completes the interface we've established.
func (*BaseCluster) Machines ¶ added in v0.2.0
func (bc *BaseCluster) Machines() []Machine
func (*BaseCluster) Name ¶ added in v0.2.0
func (bc *BaseCluster) Name() string
func (*BaseCluster) PasswordSSHClient ¶ added in v0.2.0
func (*BaseCluster) Platform ¶ added in v0.8.0
func (bc *BaseCluster) Platform() Name
func (*BaseCluster) RenderUserData ¶ added in v0.6.0
func (*BaseCluster) RuntimeConf ¶ added in v0.6.0
func (bc *BaseCluster) RuntimeConf() RuntimeConfig
func (*BaseCluster) SSH ¶ added in v0.2.0
SSH executes the given command, cmd, on the given Machine, m. It returns the stdout and stderr of the command and an error. Leading and trailing whitespace is trimmed from each.
func (*BaseCluster) SSHClient ¶ added in v0.2.0
func (bc *BaseCluster) SSHClient(ip string) (*ssh.Client, error)
func (*BaseCluster) UserSSHClient ¶ added in v0.6.0
func (bc *BaseCluster) UserSSHClient(ip, user string) (*ssh.Client, error)
type Cluster ¶
type Cluster interface { // Platform returns the name of the platform. Platform() Name // NewMachine creates a new Container Linux machine. NewMachine(userdata *conf.UserData) (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. It should log any failures; since they are not // actionable, it does not return an error Destroy() // ConsoleOutput returns a map of console output from destroyed // cluster machines. ConsoleOutput() map[string]string }
Cluster represents a cluster of Container Linux machines within a single platform.
type Journal ¶ added in v0.3.0
type Journal struct {
// contains filtered or unexported fields
}
Journal manages recording the journal of a Machine.
func NewJournal ¶ added in v0.3.0
NewJournal creates a Journal recorder that will log to "journal.txt" and "journal-raw.txt.gz" inside the given output directory.
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 // RuntimeConf returns the cluster's runtime configuration. RuntimeConf() RuntimeConfig // 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, []byte, error) // Reboot restarts the machine and waits for it to come back. Reboot() error // Destroy terminates the machine and frees associated resources. It should log // any failures; since they are not actionable, it does not return an error. Destroy() // ConsoleOutput returns the machine's console output if available, // or an empty string. Only expected to be valid after Destroy(). ConsoleOutput() string }
Machine represents a Container Linux instance.
type Options ¶ added in v0.1.4
type Options struct { BaseName string SystemdDropins []SystemdDropin }
Options contains the base options for all clusters.
type RuntimeConfig ¶ added in v0.6.0
type RuntimeConfig struct { OutputDir string NoSSHKeyInUserData bool // don't inject SSH key into Ignition/cloud-config NoSSHKeyInMetadata bool // don't add SSH key to platform metadata NoEnableSelinux bool // don't enable selinux when starting or rebooting a machine AllowFailedUnits bool // don't fail CheckMachine if a systemd unit has failed }
RuntimeConfig contains cluster-specific configuration.
type SystemdDropin ¶ added in v0.9.0
SystemdDropin is a userdata type agnostic struct representing a systemd dropin