Documentation ¶
Index ¶
- Constants
- func FinishInstanceConfig(icfg *InstanceConfig, cfg *config.Config) (err error)
- func InstanceTags(cfg *config.Config, jobs []multiwatcher.MachineJob) map[string]string
- func PopulateInstanceConfig(icfg *InstanceConfig, providerType, authorizedKeys string, ...) error
- type InstanceConfig
- func (cfg *InstanceConfig) AgentConfig(tag names.Tag, toolsVersion version.Number) (agent.ConfigSetter, error)
- func (cfg *InstanceConfig) AgentVersion() version.Binary
- func (cfg *InstanceConfig) ApiHostAddrs() []string
- func (cfg *InstanceConfig) GUITools() string
- func (cfg *InstanceConfig) InitService(renderer shell.Renderer) (service.Service, error)
- func (cfg *InstanceConfig) JujuTools() string
- func (cfg *InstanceConfig) SetTools(toolsList coretools.List) error
- func (cfg *InstanceConfig) ToolsDir(renderer shell.Renderer) string
- func (cfg *InstanceConfig) ToolsList() coretools.List
- func (cfg *InstanceConfig) VerifyConfig() (err error)
Constants ¶
const DefaultBridgeName = DefaultBridgePrefix + "eth0"
DefaultBridgeName is the network bridge device name used for LXC and KVM containers
const DefaultBridgePrefix = "br-"
DefaultBridgePrefix is the prefix for all network bridge device name used for LXC and KVM containers.
Variables ¶
This section is empty.
Functions ¶
func FinishInstanceConfig ¶
func FinishInstanceConfig(icfg *InstanceConfig, cfg *config.Config) (err error)
FinishInstanceConfig sets fields on a InstanceConfig that can be determined by inspecting a plain config.Config and the machine constraints at the last moment before bootstrapping. It assumes that the supplied Config comes from an environment that has passed through all the validation checks in the Bootstrap func, and that has set an agent-version (via finding the tools to, use for bootstrap, or otherwise). TODO(fwereade) This function is not meant to be "good" in any serious way: it is better that this functionality be collected in one place here than that it be spread out across 3 or 4 providers, but this is its only redeeming feature.
func InstanceTags ¶
func InstanceTags(cfg *config.Config, jobs []multiwatcher.MachineJob) map[string]string
InstanceTags returns the minimum set of tags that should be set on a machine instance, if the provider supports them.
func PopulateInstanceConfig ¶
func PopulateInstanceConfig(icfg *InstanceConfig, providerType, authorizedKeys string, sslHostnameVerification bool, proxySettings, aptProxySettings proxy.Settings, aptMirror string, preferIPv6 bool, enableOSRefreshUpdates bool, enableOSUpgrade bool, ) error
PopulateInstanceConfig is called both from the FinishInstanceConfig below, which does have access to the environment config, and from the container provisioners, which don't have access to the environment config. Everything that is needed to provision a container needs to be returned to the provisioner in the ContainerConfig structure. Those values are then used to call this function.
Types ¶
type InstanceConfig ¶
type InstanceConfig struct { // Tags is a set of tags to set on the instance, if supported. This // should be populated using the InstanceTags method in this package. Tags map[string]string // Bootstrap specifies whether the new instance is the bootstrap // instance. 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 // (controllers 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 instance is running a controller // (Controller is set), there must be at least one controller address supplied. // The entity name must match that of the instance being started, // or be empty when starting a controller. MongoInfo *mongo.MongoInfo // APIInfo holds the means for the new instance to communicate with the // juju state API. Unless the new instance is running a controller (Controller is // set), there must be at least one controller address supplied. // The entity name must match that of the instance being started, // or be empty when starting a controller. APIInfo *api.Info // InstanceId is the instance ID of the instance being initialised. // This is required when bootstrapping, and ignored otherwise. InstanceId instance.Id // HardwareCharacteristics contains the harrdware characteristics of // the instance 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 // GUI is the Juju GUI archive to be installed in the new instance. GUI *coretools.GUIArchive // DataDir holds the directory that juju state will be put in the new // instance. DataDir string // LogDir holds the directory that juju logs will be written to. LogDir string // MetricsSpoolDir represents the spool directory path, where all // metrics are stored. MetricsSpoolDir 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 instance // is. If the instance is not a container, then the type is "". MachineContainerType instance.ContainerType // MachineContainerHostname specifies the hostname to be used with the // cloud config for the instance. If this is not set, hostname uses the default. MachineContainerHostname string // AuthorizedKeys specifies the keys that are allowed to // connect to the instance (see cloudinit.SSHAddAuthorizedKeys) // If no keys are supplied, there can be no ssh access to the node. // On a bootstrap instance, that is fatal. On other // instances it will mean that the ssh, scp and debug-hooks // commands cannot work. AuthorizedKeys string // AgentEnvironment defines additional configuration variables to set in // the instance agent config. AgentEnvironment map[string]string // WARNING: this is only set if the instance being configured is // a controller node. // // Config holds the initial environment configuration. Config *config.Config // HostedModelConfig is a set of config attributes to be overlaid // on the controller model config (Config, above) to construct the // initial hosted model config. HostedModelConfig map[string]interface{} // Constraints holds the machine constraints. Constraints constraints.Value // ModelConstraints holds the initial model constraints. ModelConstraints constraints.Value // DisableSSLHostnameVerification can be set to true to tell cloud-init // that it shouldn't verify SSL certificates DisableSSLHostnameVerification bool // Series represents the instance 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 instance. ImageStream string // The public key used to sign Juju simplestreams image metadata. PublicImageSigningKey string // CustomImageMetadata is optional custom simplestreams image metadata // to store in environment storage at bootstrap time. This is ignored // in non-bootstrap instances. CustomImageMetadata []*imagemetadata.ImageMetadata // EnableOSRefreshUpdate specifies whether Juju will refresh its // respective OS's updates list. EnableOSRefreshUpdate bool // EnableOSUpgrade defines Juju's behavior when provisioning // instances. If enabled, the OS will perform any upgrades // available as part of its provisioning. EnableOSUpgrade bool // contains filtered or unexported fields }
InstanceConfig represents initialization information for a new juju instance.
func NewBootstrapInstanceConfig ¶
func NewBootstrapInstanceConfig( cons, modelCons constraints.Value, series, publicImageSigningKey string, ) (*InstanceConfig, error)
NewBootstrapInstanceConfig sets up a basic machine configuration for a bootstrap node. You'll still need to supply more information, but this takes care of the fixed entries and the ones that are always needed.
func NewInstanceConfig ¶
func NewInstanceConfig( machineID, machineNonce, imageStream, series, publicImageSigningKey string, secureServerConnections bool, mongoInfo *mongo.MongoInfo, apiInfo *api.Info, ) (*InstanceConfig, error)
NewInstanceConfig sets up a basic machine configuration, for a non-bootstrap node. You'll still need to supply more information, but this takes care of the fixed entries and the ones that are always needed.
func (*InstanceConfig) AgentConfig ¶
func (cfg *InstanceConfig) AgentConfig( tag names.Tag, toolsVersion version.Number, ) (agent.ConfigSetter, error)
func (*InstanceConfig) AgentVersion ¶
func (cfg *InstanceConfig) AgentVersion() version.Binary
AgentVersion returns the version of the Juju agent that will be configured on the instance. The zero value will be returned if there are no tools set.
func (*InstanceConfig) ApiHostAddrs ¶
func (cfg *InstanceConfig) ApiHostAddrs() []string
func (*InstanceConfig) GUITools ¶
func (cfg *InstanceConfig) GUITools() string
GUITools returns the directory where the Juju GUI release is stored.
func (*InstanceConfig) InitService ¶
func (*InstanceConfig) JujuTools ¶
func (cfg *InstanceConfig) JujuTools() string
JujuTools returns the directory where Juju tools are stored.
func (*InstanceConfig) SetTools ¶
func (cfg *InstanceConfig) SetTools(toolsList coretools.List) error
SetTools sets the tools that should be tried when provisioning this instance. There must be at least one. Other than the URL, each item must be the same.
TODO(axw) 2016-04-19 lp:1572116 SetTools should verify that the tools have URLs, since they will be needed for downloading on the instance. We can't do that until all usage-sites are updated to pass through non-empty URLs.
func (*InstanceConfig) ToolsDir ¶
func (cfg *InstanceConfig) ToolsDir(renderer shell.Renderer) string
func (*InstanceConfig) ToolsList ¶
func (cfg *InstanceConfig) ToolsList() coretools.List
ToolsList returns the list of tools in the order in which they will be tried.
func (*InstanceConfig) VerifyConfig ¶
func (cfg *InstanceConfig) VerifyConfig() (err error)