Documentation ¶
Index ¶
- Constants
- func AptProxyConfigMap(proxySettings proxy.Settings) map[string]interface{}
- func ConcatAuthKeys(a, b string) string
- func LatestLtsSeries() string
- func PreferredSeries(cfg HasDefaultSeries) string
- func ProxyConfigMap(proxySettings proxy.Settings) map[string]interface{}
- func ReadAuthorizedKeys(path string) (string, error)
- func SpecializeCharmRepo(repo charm.Repository, cfg *Config) charm.Repository
- func Validate(cfg, old *Config) error
- type Config
- func (c *Config) APIPort() int
- func (c *Config) AdminSecret() string
- func (c *Config) AgentVersion() (version.Number, bool)
- func (c *Config) AllAttrs() map[string]interface{}
- func (c *Config) Apply(attrs map[string]interface{}) (*Config, error)
- func (c *Config) AptFtpProxy() string
- func (c *Config) AptHttpProxy() string
- func (c *Config) AptHttpsProxy() string
- func (c *Config) AptProxySettings() proxy.Settings
- func (c *Config) AuthorizedKeys() string
- func (c *Config) BootstrapSSHOpts() SSHTimeoutOpts
- func (c *Config) CACert() (string, bool)
- func (c *Config) CAPrivateKey() (key string, ok bool)
- func (c *Config) CharmStoreAuth() (string, bool)
- func (c *Config) DefaultSeries() (string, bool)
- func (c *Config) Development() bool
- func (c *Config) FirewallMode() string
- func (c *Config) FtpProxy() string
- func (cfg *Config) GenerateStateServerCertAndKey() (string, string, error)
- func (c *Config) HttpProxy() string
- func (c *Config) HttpsProxy() string
- func (c *Config) ImageMetadataURL() (string, bool)
- func (c *Config) ImageStream() string
- func (c *Config) LXCUseClone() (bool, bool)
- func (c *Config) LXCUseCloneAUFS() (bool, bool)
- func (c *Config) LoggingConfig() string
- func (c *Config) Name() string
- func (c *Config) NoProxy() string
- func (c *Config) ProvisionerSafeMode() bool
- func (c *Config) ProxySSH() bool
- func (c *Config) ProxySettings() proxy.Settings
- func (c *Config) Remove(attrs []string) (*Config, error)
- func (c *Config) RsyslogCACert() string
- func (c *Config) SSLHostnameVerification() bool
- func (c *Config) StatePort() int
- func (c *Config) SyslogPort() int
- func (c *Config) TestMode() bool
- func (c *Config) ToolsURL() (string, bool)
- func (c *Config) Type() string
- func (c *Config) UnknownAttrs() map[string]interface{}
- func (cfg *Config) ValidateUnknownAttrs(fields schema.Fields, defaults schema.Defaults) (map[string]interface{}, error)
- type Defaulting
- type HasDefaultSeries
- type SSHTimeoutOpts
- type Specializer
Constants ¶
const ( // AuthKeysConfig is the configuration key for authorised keys. AuthKeysConfig = "authorized-keys" // JujuSystemKey is the SSH key comment for Juju system keys. JujuSystemKey = "juju-system-key" )
const ( // FwInstance requests the use of an individual firewall per instance. FwInstance = "instance" // FwGlobal requests the use of a single firewall group for all machines. // When ports are opened for one machine, all machines will have the same // port opened. FwGlobal = "global" // DefaultStatePort is the default port the state server is listening on. DefaultStatePort int = 37017 // DefaultApiPort is the default port the API server is listening on. DefaultAPIPort int = 17070 // DefaultSyslogPort is the default port that the syslog UDP/TCP listener is // listening on. DefaultSyslogPort int = 6514 // DefaultBootstrapSSHTimeout is the amount of time to wait // contacting a state server, in seconds. DefaultBootstrapSSHTimeout int = 600 // DefaultBootstrapSSHRetryDelay is the amount of time between // attempts to connect to an address, in seconds. DefaultBootstrapSSHRetryDelay int = 5 // DefaultBootstrapSSHAddressesDelay is the amount of time between // refreshing the addresses, in seconds. Not too frequent, as we // refresh addresses from the provider each time. DefaultBootstrapSSHAddressesDelay int = 10 )
Variables ¶
This section is empty.
Functions ¶
func AptProxyConfigMap ¶
AptProxyConfigMap returns a map suitable to be applied to a Config to update proxy settings.
func ConcatAuthKeys ¶
ConcatAuthKeys concatenates the two sets of authorised keys, interposing a newline if necessary, because authorised keys are newline-separated.
func LatestLtsSeries ¶
func LatestLtsSeries() string
func PreferredSeries ¶
func PreferredSeries(cfg HasDefaultSeries) string
PreferredSeries returns the preferred series to use when a charm does not explicitly specify a series.
func ProxyConfigMap ¶
ProxyConfigMap returns a map suitable to be applied to a Config to update proxy settings.
func ReadAuthorizedKeys ¶
ReadAuthorizedKeys implements the standard juju behaviour for finding authorized_keys. It returns a set of keys in in authorized_keys format (see sshd(8) for a description). If path is non-empty, it names the file to use; otherwise the user's .ssh directory will be searched. Home directory expansion will be performed on the path if it starts with a ~; if the expanded path is relative, it will be interpreted relative to $HOME/.ssh.
The result of utils/ssh.PublicKeyFiles will always be prepended to the result. In practice, this means ReadAuthorizedKeys never returns an error when the call originates in the CLI.
func SpecializeCharmRepo ¶
func SpecializeCharmRepo(repo charm.Repository, cfg *Config) charm.Repository
SpecializeCharmRepo returns a repository customized for given configuration. It adds authentication if necessary and sets a charm store's testMode flag.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config holds an immutable environment configuration.
func New ¶
func New(withDefaults Defaulting, attrs map[string]interface{}) (*Config, error)
New returns a new configuration. Fields that are common to all environment providers are verified. If useDefaults is UseDefaults, default values will be taken from the environment.
Specifically, the "authorized-keys-path" key is translated into "authorized-keys" by loading the content from respective file. Similarly, "ca-cert-path" and "ca-private-key-path" are translated into the "ca-cert" and "ca-private-key" values. If not specified, authorized SSH keys and CA details will be read from:
~/.ssh/id_dsa.pub ~/.ssh/id_rsa.pub ~/.ssh/identity.pub ~/.juju/<name>-cert.pem ~/.juju/<name>-private-key.pem
The required keys (after any files have been read) are "name", "type" and "authorized-keys", all of type string. Additional keys recognised are "agent-version" (string) and "development" (bool) as well as charm-store-auth (string containing comma-separated key=value pairs).
func (*Config) AdminSecret ¶
AdminSecret returns the administrator password. It's empty if the password has not been set.
func (*Config) AgentVersion ¶
AgentVersion returns the proposed version number for the agent tools, and whether it has been set. Once an environment is bootstrapped, this must always be valid.
func (*Config) AptFtpProxy ¶
AptFtpProxy returns the apt ftp proxy for the environment. Falls back to the default ftp-proxy if not specified.
func (*Config) AptHttpProxy ¶
AptHttpProxy returns the apt http proxy for the environment. Falls back to the default http-proxy if not specified.
func (*Config) AptHttpsProxy ¶
AptHttpsProxy returns the apt https proxy for the environment. Falls back to the default https-proxy if not specified.
func (*Config) AptProxySettings ¶
AptProxySettings returns all three proxy settings; http, https and ftp.
func (*Config) AuthorizedKeys ¶
AuthorizedKeys returns the content for ssh's authorized_keys file.
func (*Config) BootstrapSSHOpts ¶
func (c *Config) BootstrapSSHOpts() SSHTimeoutOpts
BootstrapSSHOpts returns the SSH timeout and retry delays used during bootstrap.
func (*Config) CACert ¶
CACert returns the certificate of the CA that signed the state server certificate, in PEM format, and whether the setting is available.
func (*Config) CAPrivateKey ¶
CAPrivateKey returns the private key of the CA that signed the state server certificate, in PEM format, and whether the setting is available.
func (*Config) CharmStoreAuth ¶
Auth token sent to charm store
func (*Config) DefaultSeries ¶
DefaultSeries returns the configured default Ubuntu series for the environment, and whether the default series was explicitly configured on the environment.
func (*Config) Development ¶
Development returns whether the environment is in development mode.
func (*Config) FirewallMode ¶
FirewallMode returns whether the firewall should manage ports per machine or global (FwInstance or FwGlobal)
func (*Config) GenerateStateServerCertAndKey ¶
GenerateStateServerCertAndKey makes sure that the config has a CACert and CAPrivateKey, generates and retruns new certificate and key.
func (*Config) HttpsProxy ¶
HttpsProxy returns the https proxy for the environment.
func (*Config) ImageMetadataURL ¶
ImageMetadataURL returns the URL at which the metadata used to locate image ids is located, and wether it has been set.
func (*Config) ImageStream ¶
ImageStream returns the simplestreams stream used to identify which image ids to search when starting an instance.
func (*Config) LXCUseClone ¶
LXCUseClone reports whether the LXC provisioner should create a template and use cloning to speed up container provisioning.
func (*Config) LXCUseCloneAUFS ¶
LXCUseCloneAUFS reports whether the LXC provisioner should create a lxc clone using aufs if available.
func (*Config) LoggingConfig ¶
LoggingConfig returns the configuration string for the loggers.
func (*Config) ProvisionerSafeMode ¶
ProvisionerSafeMode reports whether the provisioner should not destroy machines it does not know about.
func (*Config) ProxySSH ¶
ProxySSH returns a flag indicating whether SSH commands should be proxied through the API server.
func (*Config) ProxySettings ¶
ProxySettings returns all four proxy settings; http, https, ftp, and no proxy.
func (*Config) Remove ¶
Remove returns a new configuration that has the attributes of c minus attrs.
func (*Config) RsyslogCACert ¶
RsyslogCACert returns the certificate of the CA that signed the rsyslog certificate, in PEM format, or nil if one hasn't been generated yet.
func (*Config) SSLHostnameVerification ¶
SSLHostnameVerification returns weather the environment has requested SSL hostname verification to be enabled.
func (*Config) SyslogPort ¶
SyslogPort returns the syslog port for the environment.
func (*Config) TestMode ¶
TestMode indicates if the environment is intended for testing. In this case, accessing the charm store does not affect statistical data of the store.
func (*Config) ToolsURL ¶
ToolsURL returns the URL that locates the tools tarballs and metadata, and whether it has been set.
func (*Config) UnknownAttrs ¶
UnknownAttrs returns a copy of the raw configuration attributes that are supposedly specific to the environment type. They could also be wrong attributes, though. Only the specific environment implementation can tell.
func (*Config) ValidateUnknownAttrs ¶
func (cfg *Config) ValidateUnknownAttrs(fields schema.Fields, defaults schema.Defaults) (map[string]interface{}, error)
ValidateUnknownAttrs checks the unknown attributes of the config against the supplied fields and defaults, and returns an error if any fails to validate. Unknown fields are warned about, but preserved, on the basis that they are reasonably likely to have been written by or for a version of juju that does recognise the fields, but that their presence is still anomalous to some degree and should be flagged (and that there is thereby a mechanism for observing fields that really are typos etc).
type Defaulting ¶
type Defaulting bool
Defaulting is a value that specifies whether a configuration creator should use defaults from the environment.
const ( UseDefaults Defaulting = true NoDefaults Defaulting = false )
type HasDefaultSeries ¶
type SSHTimeoutOpts ¶
type SSHTimeoutOpts struct { // Timeout is the amount of time to wait contacting a state // server. Timeout time.Duration // RetryDelay is the amount of time between attempts to connect to // an address. RetryDelay time.Duration // AddressesDelay is the amount of time between refreshing the // addresses. AddressesDelay time.Duration }
SSHTimeoutOpts lists the amount of time we will wait for various parts of the SSH connection to complete. This is similar to DialOpts, see http://pad.lv/1258889 about possibly deduplicating them.
type Specializer ¶
type Specializer interface { WithAuthAttrs(string) charm.Repository WithTestMode(testMode bool) charm.Repository }