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,
    	aptMirror string,
    	c *cloudinit.Config,
    	addUpdateScripts bool,
    	addUpgradeScripts bool,
    )

      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 and mirror settings if there are any.

      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
        
        	// MongoInfo holds the means for the new instance to communicate with the
        	// juju state database. 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.
        	MongoInfo *mongo.MongoInfo
        
        	// 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 []multiwatcher.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
        
        	// Series represents the machine series.
        	Series string
        
        	// MachineAgentServiceName is the init 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
        
        	// AptMirror defines an APT mirror location, which, if specified, will
        	// override the default APT sources.
        	AptMirror string
        
        	// PreferIPv6 mirrors the value of prefer-ipv6 environment setting
        	// and when set IPv6 addresses for connecting to the API/state
        	// servers will be preferred over IPv4 ones.
        	PreferIPv6 bool
        
        	// The type of Simple Stream to download and deploy on this machine.
        	ImageStream string
        
        	// CustomImageMetadata is optional custom simplestreams image metadata
        	// to store in environment storage at bootstrap time. This is ignored
        	// in non-bootstrap machines.
        	CustomImageMetadata []*imagemetadata.ImageMetadata
        
        	// EnableOSRefreshUpdate specifies whether Juju will refresh its
        	// respective OS's updates list.
        	EnableOSRefreshUpdate bool
        
        	// EnableOSUpgrade defines Juju's behavior when provisioning
        	// machines. If enabled, the OS will perform any upgrades
        	// available as part of its provisioning.
        	EnableOSUpgrade bool
        }

          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.

            type UserdataConfig

            type UserdataConfig interface {
            	// Configure is a convenience function that updates the cloudinit.Config
            	// with appropriate configuration. It will run ConfigureBasic() and
            	// ConfigureJuju()
            	Configure() error
            	// ConfigureBasic updates the provided cloudinit.Config with
            	// basic configuration to initialise an OS image.
            	ConfigureBasic() error
            	// ConfigureJuju updates the provided cloudinit.Config with configuration
            	// to initialise a Juju machine agent.
            	ConfigureJuju() error
            	// Render renders the cloudinit/cloudbase-init userdata needed to initialize
            	// the juju agent
            	Render() ([]byte, error)
            }

            func NewUserdataConfig

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