cloudinit

package
v0.0.0-...-6337964 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2014 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const CanonicalCloudArchiveSigningKey = `` /* 3159-byte string literal not displayed */
View Source
const NonceFile = "nonce.txt"

NonceFile is written by cloud-init as the last thing it does. The file will contain the machine's nonce. The filename is relative to the Juju data-dir.

Variables

This section is empty.

Functions

func AddAptCommands

func AddAptCommands(proxySettings proxy.Settings, c *cloudinit.Config)

AddAptCommands update the cloudinit.Config instance with the necessary packages, the request to do the apt-get update/upgrade on boot, and adds the apt proxy settings if there are any.

func Configure

func Configure(cfg *MachineConfig, c *cloudinit.Config) error

Configure updates the provided cloudinit.Config with configuration to initialize a Juju machine agent.

func ConfigureBasic

func ConfigureBasic(cfg *MachineConfig, c *cloudinit.Config) error

ConfigureBasic updates the provided cloudinit.Config with basic configuration to initialise an OS image, such that it can be connected to via SSH, and log to a standard location.

Any potentially failing operation should not be added to the configuration, but should instead be done in ConfigureJuju.

Note: we don't do apt update/upgrade here so as not to have to wait on apt to finish when performing the second half of image initialisation. Doing it later brings the benefit of feedback in the face of errors, but adds to the running time of initialisation due to lack of activity between image bringup and start of agent installation.

func ConfigureJuju

func ConfigureJuju(cfg *MachineConfig, c *cloudinit.Config) error

ConfigureJuju updates the provided cloudinit.Config with configuration to initialise a Juju machine agent.

func MaybeAddCloudArchiveCloudTools

func MaybeAddCloudArchiveCloudTools(c *cloudinit.Config, series string)

MaybeAddCloudArchiveCloudTools adds the cloud-archive cloud-tools pocket to apt sources, if the series requires it.

Types

type MachineConfig

type MachineConfig struct {
	// Bootstrap specifies whether the new machine is the bootstrap
	// machine. When this is true, StateServingInfo should be set
	// and filled out.
	Bootstrap bool

	// StateServingInfo holds the information for serving the state.
	// This must only be set if the Bootstrap field is true
	// (state servers started subsequently will acquire their serving info
	// from another server)
	StateServingInfo *params.StateServingInfo

	// StateInfo holds the means for the new instance to communicate with the
	// juju state. Unless the new machine is running a state server (StateServer is
	// set), there must be at least one state server address supplied.
	// The entity name must match that of the machine being started,
	// or be empty when starting a state server.
	StateInfo *state.Info

	// APIInfo holds the means for the new instance to communicate with the
	// juju state API. Unless the new machine is running a state server (StateServer is
	// set), there must be at least one state server address supplied.
	// The entity name must match that of the machine being started,
	// or be empty when starting a state server.
	APIInfo *api.Info

	// InstanceId is the instance ID of the machine being initialised.
	// This is required when bootstrapping, and ignored otherwise.
	InstanceId instance.Id

	// HardwareCharacteristics contains the harrdware characteristics of
	// the machine being initialised. This optional, and is only used by
	// the bootstrap agent during state initialisation.
	HardwareCharacteristics *instance.HardwareCharacteristics

	// MachineNonce is set at provisioning/bootstrap time and used to
	// ensure the agent is running on the correct instance.
	MachineNonce string

	// Tools is juju tools to be used on the new machine.
	Tools *coretools.Tools

	// DataDir holds the directory that juju state will be put in the new
	// machine.
	DataDir string

	// LogDir holds the directory that juju logs will be written to.
	LogDir string

	// Jobs holds what machine jobs to run.
	Jobs []params.MachineJob

	// CloudInitOutputLog specifies the path to the output log for cloud-init.
	// The directory containing the log file must already exist.
	CloudInitOutputLog string

	// MachineId identifies the new machine.
	MachineId string

	// MachineContainerType specifies the type of container that the machine
	// is.  If the machine is not a container, then the type is "".
	MachineContainerType instance.ContainerType

	// Networks holds a list of networks the machine should be on.
	Networks []string

	// AuthorizedKeys specifies the keys that are allowed to
	// connect to the machine (see cloudinit.SSHAddAuthorizedKeys)
	// If no keys are supplied, there can be no ssh access to the node.
	// On a bootstrap machine, that is fatal. On other
	// machines it will mean that the ssh, scp and debug-hooks
	// commands cannot work.
	AuthorizedKeys string

	// AgentEnvironment defines additional configuration variables to set in
	// the machine agent config.
	AgentEnvironment map[string]string

	// WARNING: this is only set if the machine being configured is
	// a state server node.
	//
	// Config holds the initial environment configuration.
	Config *config.Config

	// Constraints holds the initial environment constraints.
	Constraints constraints.Value

	// DisableSSLHostnameVerification can be set to true to tell cloud-init
	// that it shouldn't verify SSL certificates
	DisableSSLHostnameVerification bool

	// SystemPrivateSSHKey is created at bootstrap time and recorded on every
	// node that has an API server. At this stage, that is any machine where
	// StateServer (member above) is set to true.
	SystemPrivateSSHKey string

	// DisablePackageCommands is a flag that specifies whether to suppress
	// the addition of package management commands.
	DisablePackageCommands bool

	// MachineAgentServiceName is the Upstart service name for the Juju machine agent.
	MachineAgentServiceName string

	// ProxySettings define normal http, https and ftp proxies.
	ProxySettings proxy.Settings

	// AptProxySettings define the http, https and ftp proxy settings to use
	// for apt, which may or may not be the same as the normal ProxySettings.
	AptProxySettings proxy.Settings
}

MachineConfig represents initialization information for a new juju machine.

func (*MachineConfig) HasNetworks

func (cfg *MachineConfig) HasNetworks() bool

HasNetworks returns if there are any networks set.

Jump to

Keyboard shortcuts

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