cloudinit

package
v0.0.0-...-65247a5 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 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.

View Source
const SystemIdentity = "system-identity"

SystemIdentity is the name of the file where the environment SSH key is kept.

Variables

View Source
var BootstrapStateURLFile string = path.Join(tmpdir, "provider-state-url")

Functions

func AddAptCommands

func AddAptCommands(proxy osenv.ProxySettings, c *cloudinit.Config, cfg *MachineConfig)

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.

func NixConfigureBasic

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

func NixConfigureJuju

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

func WinConfigureBasic

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

func WinConfigureJuju

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

Types

type MachineConfig

type MachineConfig struct {
	// StateServer specifies whether the new machine will run the
	// mongo and API servers.
	StateServer bool

	// StateServerCert and StateServerKey hold the state server
	// certificate and private key in PEM format; they are required when
	// StateServer is set, and ignored otherwise.
	StateServerCert []byte
	StateServerKey  []byte

	// StatePort specifies the TCP port that will be used
	// by the MongoDB server. It must be non-zero
	// if StateServer is true.
	StatePort int

	// APIPort specifies the TCP port that will be used
	// by the API server. It must be non-zero
	// if StateServer is true.
	APIPort int

	// 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

	// 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

	// 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

	// StateInfoURL is the URL of a file which contains information about the state server machines.
	StateInfoURL string

	// 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

	// MongoServiceName is the Upstart service name for the Mongo database.
	MongoServiceName string

	// ProxySettings define normal http, https and ftp proxies.
	ProxySettings osenv.ProxySettings

	// 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 osenv.ProxySettings
}

MachineConfig represents initialization information for a new juju machine.

func (*MachineConfig) NeedMongoPPA

func (cfg *MachineConfig) NeedMongoPPA() bool

func (*MachineConfig) TargetRelease

func (cfg *MachineConfig) TargetRelease() string

TargetRelease returns a string suitable for use with apt-get --target-release based on the machines series.

Jump to

Keyboard shortcuts

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