Documentation
¶
Index ¶
- Constants
- func AptProxyConfigMap(proxySettings proxy.Settings) map[string]interface{}
- func CoerceForStorage(attrs map[string]interface{}) map[string]interface{}
- func ConcatAuthKeys(a, b string) string
- func ConfigDefaults() map[string]interface{}
- func PreferredSeries(cfg HasDefaultSeries) string
- func ProcessDeprecatedAttributes(attrs map[string]interface{}) map[string]interface{}
- func ProxyConfigMap(proxySettings proxy.Settings) map[string]interface{}
- func Schema(extra environschema.Fields) (environschema.Fields, error)
- func SpecializeCharmRepo(repo charmrepo.Interface, cfg *Config) charmrepo.Interface
- func Validate(cfg, old *Config) error
- type AttributeDefaultValues
- type Config
- func (c *Config) AgentMetadataURL() (string, bool)
- func (c *Config) AgentStream() 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) AptMirror() string
- func (c *Config) AptProxySettings() proxy.Settings
- func (c *Config) AuthorizedKeys() string
- func (c *Config) AutomaticallyRetryHooks() bool
- func (c *Config) DefaultSeries() (string, bool)
- func (c *Config) Development() bool
- func (c *Config) DisableNetworkManagement() (bool, bool)
- func (c *Config) EnableOSRefreshUpdate() bool
- func (c *Config) EnableOSUpgrade() bool
- func (c *Config) FTPProxy() string
- func (c *Config) FirewallMode() string
- func (c *Config) HTTPProxy() string
- func (c *Config) HTTPSProxy() string
- func (c *Config) IgnoreMachineAddresses() (bool, bool)
- func (c *Config) ImageMetadataURL() (string, bool)
- func (c *Config) ImageStream() string
- func (c *Config) LogFwdSyslog() (*syslog.RawConfig, bool)
- func (c *Config) LoggingConfig() string
- func (c *Config) Name() string
- func (c *Config) NoProxy() string
- func (c *Config) ProvisionerHarvestMode() HarvestMode
- func (c *Config) ProxySSH() bool
- func (c *Config) ProxySettings() proxy.Settings
- func (c *Config) Remove(attrs []string) (*Config, error)
- func (c *Config) ResourceTags() (map[string]string, bool)
- func (c *Config) SSLHostnameVerification() bool
- func (c *Config) StorageDefaultBlockSource() (string, bool)
- func (c *Config) TestMode() bool
- func (c *Config) TransmitVendorMetrics() bool
- func (c *Config) Type() string
- func (c *Config) UUID() string
- func (c *Config) UnknownAttrs() map[string]interface{}
- func (cfg *Config) ValidateUnknownAttrs(fields schema.Fields, defaults schema.Defaults) (map[string]interface{}, error)
- type ConfigSchemaSource
- type ConfigValue
- type ConfigValues
- type Defaulting
- type HarvestMode
- type HasDefaultSeries
- type InvalidConfigValueError
- type ModelDefaultAttributes
- type RegionDefaultValue
- type Validator
Constants ¶
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" // FwNone requests that no firewalling should be performed inside // the environment. No firewaller worker will be started. It's // useful for clouds without support for either global or per // instance security groups. FwNone = "none" )
const ( // NameKey is the key for the model's name. NameKey = "name" // TypeKey is the key for the model's cloud type. TypeKey = "type" // AgentVersionKey is the key for the model's Juju agent version. AgentVersionKey = "agent-version" // UUIDKey is the key for the model UUID attribute. UUIDKey = "uuid" // AuthorizedKeysKey is the key for the authorized-keys attribute. AuthorizedKeysKey = "authorized-keys" // ProvisionerHarvestModeKey stores the key for this setting. ProvisionerHarvestModeKey = "provisioner-harvest-mode" // AgentStreamKey stores the key for this setting. AgentStreamKey = "agent-stream" // AgentMetadataURLKey stores the key for this setting. AgentMetadataURLKey = "agent-metadata-url" // HTTPProxyKey stores the key for this setting. HTTPProxyKey = "http-proxy" // HTTPSProxyKey stores the key for this setting. HTTPSProxyKey = "https-proxy" // FTPProxyKey stores the key for this setting. FTPProxyKey = "ftp-proxy" // AptHTTPProxyKey stores the key for this setting. AptHTTPProxyKey = "apt-http-proxy" // AptHTTPSProxyKey stores the key for this setting. AptHTTPSProxyKey = "apt-https-proxy" // AptFTPProxyKey stores the key for this setting. AptFTPProxyKey = "apt-ftp-proxy" // NoProxyKey stores the key for this setting. NoProxyKey = "no-proxy" // The default block storage source. StorageDefaultBlockSourceKey = "storage-default-block-source" // ResourceTagsKey is an optional list or space-separated string // of k=v pairs, defining the tags for ResourceTags. ResourceTagsKey = "resource-tags" // LogForwardEnabled determines whether the log forward functionality is enabled. LogForwardEnabled = "logforward-enabled" // LogFwdSyslogHost sets the hostname:port of the syslog server. LogFwdSyslogHost = "syslog-host" // LogFwdSyslogCACert sets the certificate of the CA that signed the syslog // server certificate. LogFwdSyslogCACert = "syslog-ca-cert" // LogFwdSyslogClientCert sets the client certificate for syslog // forwarding. LogFwdSyslogClientCert = "syslog-client-cert" // LogFwdSyslogClientKey sets the client key for syslog // forwarding. LogFwdSyslogClientKey = "syslog-client-key" // AutomaticallyRetryHooks determines whether the uniter will // automatically retry a hook that has failed AutomaticallyRetryHooks = "automatically-retry-hooks" // TransmitVendorMetricsKey is the key for whether the controller sends // metrics collected in this model for anonymized aggregate analytics. TransmitVendorMetricsKey = "transmit-vendor-metrics" // IgnoreMachineAddresses, when true, will cause the // machine worker not to discover any machine addresses // on start up. IgnoreMachineAddresses = "ignore-machine-addresses" )
TODO(katco-): Please grow this over time. Centralized place to store values of config keys. This transitions mistakes in referencing key-values to a compile-time error.
const ( // JujuDefaultSource is used to label model config attributes that // come from hard coded defaults. JujuDefaultSource = "default" // JujuControllerSource is used to label model config attributes that // come from those associated with the controller. JujuControllerSource = "controller" // JujuRegionSource is used to label model config attributes that come from // those associated with the region where the model is // running. JujuRegionSource = "region" // JujuModelConfigSource is used to label model config attributes that // have been explicitly set by the user. JujuModelConfigSource = "model" )
These constants define named sources of model config attributes. After a call to UpdateModelConfig, any attributes added/removed will have a source of JujuModelConfigSource.
const (
// JujuSystemKey is the SSH key comment for Juju system keys.
JujuSystemKey = "juju-system-key"
)
Variables ¶
This section is empty.
Functions ¶
func AptProxyConfigMap ¶
AptProxyConfigMap returns a map suitable to be applied to a Config to update proxy settings.
func CoerceForStorage ¶
CoerceForStorage transforms attributes prior to being saved in a persistent store.
func ConcatAuthKeys ¶
ConcatAuthKeys concatenates the two sets of authorised keys, interposing a newline if necessary, because authorised keys are newline-separated.
func ConfigDefaults ¶
func ConfigDefaults() map[string]interface{}
ConfigDefaults returns the config default values to be used for any new model where there is no value yet defined.
func PreferredSeries ¶
func PreferredSeries(cfg HasDefaultSeries) string
PreferredSeries returns the preferred series to use when a charm does not explicitly specify a series.
func ProcessDeprecatedAttributes ¶
ProcessDeprecatedAttributes gathers any deprecated attributes in attrs and adds or replaces them with new name value pairs for the replacement attrs. Ths ensures that older versions of Juju which require that deprecated attribute values still be used will work as expected.
func ProxyConfigMap ¶
ProxyConfigMap returns a map suitable to be applied to a Config to update proxy settings.
func Schema ¶
func Schema(extra environschema.Fields) (environschema.Fields, error)
Schema returns a configuration schema that includes both the given extra fields and all the fields defined in this package. It returns an error if extra defines any fields defined in this package.
func SpecializeCharmRepo ¶
func SpecializeCharmRepo(repo charmrepo.Interface, cfg *Config) charmrepo.Interface
SpecializeCharmRepo customizes a repository for a given configuration. It returns a charm repository with test mode enabled if applicable.
Types ¶
type AttributeDefaultValues ¶
type AttributeDefaultValues struct { // Default and Controller represent the values as set at those levels. Default interface{} `json:"default,omitempty" yaml:"default,omitempty"` Controller interface{} `json:"controller,omitempty" yaml:"controller,omitempty"` // Regions is a slice of Region representing the values as set in each // region. Regions []RegionDefaultValue `json:"regions,omitempty" yaml:"regions,omitempty"` }
AttributeDefaultValues represents all the default values at each level for a given setting.
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.
"ca-cert-path" and "ca-private-key-path" are translated into the "ca-cert" and "ca-private-key" values. If not specified, CA details will be read from:
~/.local/share/juju/<name>-cert.pem ~/.local/share/juju/<name>-private-key.pem
if $XDG_DATA_HOME is defined it will be used instead of ~/.local/share
func (*Config) AgentMetadataURL ¶
AgentMetadataURL returns the URL that locates the agent tarballs and metadata, and whether it has been set.
func (*Config) AgentStream ¶
AgentStream returns the simplestreams stream used to identify which tools to use when when bootstrapping or upgrading an environment.
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) AutomaticallyRetryHooks ¶
AutomaticallyRetryHooks returns whether we should automatically retry hooks. By default this should be true.
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) DisableNetworkManagement ¶
DisableNetworkManagement reports whether Juju is allowed to configure and manage networking inside the environment.
func (*Config) EnableOSRefreshUpdate ¶
EnableOSRefreshUpdate returns whether or not newly provisioned instances should run their respective OS's update capability.
func (*Config) EnableOSUpgrade ¶
EnableOSUpgrade returns whether or not newly provisioned instances should run their respective OS's upgrade capability.
func (*Config) FirewallMode ¶
FirewallMode returns whether the firewall should manage ports per machine, globally, or not at all. (FwInstance, FwGlobal, or FwNone).
func (*Config) HTTPSProxy ¶
HTTPSProxy returns the https proxy for the environment.
func (*Config) IgnoreMachineAddresses ¶
IgnoreMachineAddresses reports whether Juju will discover and store machine addresses on startup.
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) LogFwdSyslog ¶
LogFwdSyslog returns the syslog forwarding config.
func (*Config) LoggingConfig ¶
LoggingConfig returns the configuration string for the loggers.
func (*Config) ProvisionerHarvestMode ¶
func (c *Config) ProvisionerHarvestMode() HarvestMode
ProvisionerHarvestMode reports the harvesting methodology the provisioner should take.
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) ResourceTags ¶
ResourceTags returns a set of tags to set on environment resources that Juju creates and manages, if the provider supports them. These tags have no special meaning to Juju, but may be used for existing chargeback accounting schemes or other identification purposes.
func (*Config) SSLHostnameVerification ¶
SSLHostnameVerification returns weather the environment has requested SSL hostname verification to be enabled.
func (*Config) StorageDefaultBlockSource ¶
StorageDefaultBlockSource returns the default block storage source 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) TransmitVendorMetrics ¶
TransmitVendorMetrics returns whether the controller sends charm-collected metrics in this model for anonymized aggregate analytics. By default this should be true.
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 ConfigSchemaSource ¶
type ConfigSchemaSource interface { // ConfigSchema returns extra config attributes specific // to this provider only. ConfigSchema() schema.Fields // ConfigDefaults returns the default values for the // provider specific config attributes. ConfigDefaults() schema.Defaults }
ConfigSchemaSource instances provide information on config attributes and the default attribute values.
type ConfigValue ¶
type ConfigValue struct { // Value is the configuration value. Value interface{} // Source is the name of the inherited config // source from where the value originates. Source string }
ConfigValue encapsulates a configuration value and its source.
type ConfigValues ¶
type ConfigValues map[string]ConfigValue
ConfigValues is a map of configuration values keyed by attribute name.
func (ConfigValues) AllAttrs ¶
func (c ConfigValues) AllAttrs() map[string]interface{}
AllAttrs returns just the attribute values from the config.
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 HarvestMode ¶
type HarvestMode uint32
HarvestMode is a bit field which is used to store the harvesting behavior for Juju.
const ( // HarvestNone signifies that Juju should not harvest any // machines. HarvestNone HarvestMode = 1 << iota // HarvestUnknown signifies that Juju should only harvest machines // which exist, but we don't know about. HarvestUnknown // HarvestDestroyed signifies that Juju should only harvest // machines which have been explicitly released by the user // through a destroy of a service/model/unit. HarvestDestroyed // HarvestAll signifies that Juju should harvest both unknown and // destroyed instances. ♫ Don't fear the reaper. ♫ HarvestAll HarvestMode = HarvestUnknown | HarvestDestroyed )
func ParseHarvestMode ¶
func ParseHarvestMode(description string) (HarvestMode, error)
ParseHarvestMode parses description of harvesting method and returns the representation.
func (HarvestMode) HarvestDestroyed ¶
func (method HarvestMode) HarvestDestroyed() bool
Destroyed returns whether or not the Destroyed harvesting flag is set.
func (HarvestMode) HarvestNone ¶
func (method HarvestMode) HarvestNone() bool
None returns whether or not the None harvesting flag is set.
func (HarvestMode) HarvestUnknown ¶
func (method HarvestMode) HarvestUnknown() bool
Unknown returns whether or not the Unknown harvesting flag is set.
func (HarvestMode) String ¶
func (method HarvestMode) String() string
String returns the description of the harvesting mode.
type HasDefaultSeries ¶
type InvalidConfigValueError ¶
type InvalidConfigValueError struct { // Key is the config key used to access the value. Key string // Value is the value that failed validation. Value string // Reason indicates why the value failed validation. Reason error }
InvalidConfigValue is an error type for a config value that failed validation.
func (*InvalidConfigValueError) Error ¶
func (e *InvalidConfigValueError) Error() string
Error returns the error string.
type ModelDefaultAttributes ¶
type ModelDefaultAttributes map[string]AttributeDefaultValues
ModelDefaultAttributes is a map of configuration values to a list of possible values.
type RegionDefaultValue ¶
type RegionDefaultValue struct { // Name represents the region name for this specific setting. Name string `json:"name" yaml:"name"` // Value is the value of the setting this represents in the named region. Value interface{} `json:"value" yaml:"value"` }
RegionDefaultValue holds the region information for each region in DefaultSetting.
type Validator ¶
type Validator interface { // Validate ensures that cfg is a valid configuration. // If old is not nil, Validate should use it to determine // whether a configuration change is valid. // // TODO(axw) Validate should just return an error. We should // use a separate mechanism for updating config. Validate(cfg, old *Config) (valid *Config, _ error) }
Validator is an interface for validating model configuration.