config

package
v0.0.0-...-298751d Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 28 Imported by: 561

Documentation

Index

Constants

View Source
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"
)
View Source
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"

	// NumProvisionWorkersKey is the key for number of model provisioner
	// workers.
	NumProvisionWorkersKey = "num-provision-workers"

	// NumContainerProvisionWorkersKey is the key for the number of
	// container provisioner workers per machine setting.
	NumContainerProvisionWorkersKey = "num-container-provision-workers"

	// ImageStreamKey is the key used to specify the stream
	// for OS images.
	ImageStreamKey = "image-stream"

	// ImageMetadataURLKey is the key used to specify the location
	// of OS image metadata.
	ImageMetadataURLKey = "image-metadata-url"

	// ImageMetadataDefaultsDisabledKey is the key used to disable image
	// metadata default sources.
	ImageMetadataDefaultsDisabledKey = "image-metadata-defaults-disabled"

	// AgentStreamKey stores the key for this setting.
	AgentStreamKey = "agent-stream"

	// AgentMetadataURLKey stores the key for this setting.
	AgentMetadataURLKey = "agent-metadata-url"

	// ContainerImageStreamKey is the key used to specify the stream
	// for container OS images.
	ContainerImageStreamKey = "container-image-stream"

	// ContainerImageMetadataURLKey is the key used to specify the location
	// of OS image metadata for containers.
	ContainerImageMetadataURLKey = "container-image-metadata-url"

	// ContainerImageMetadataDefaultsDisabledKey is the key used to disable image
	// metadata default sources for containers.
	ContainerImageMetadataDefaultsDisabledKey = "container-image-metadata-defaults-disabled"

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

	// NoProxyKey stores the key for this setting.
	NoProxyKey = "no-proxy"

	// JujuHTTPProxyKey stores the key for this setting.
	JujuHTTPProxyKey = "juju-http-proxy"

	// JujuHTTPSProxyKey stores the key for this setting.
	JujuHTTPSProxyKey = "juju-https-proxy"

	// JujuFTPProxyKey stores the key for this setting.
	JujuFTPProxyKey = "juju-ftp-proxy"

	// JujuNoProxyKey stores the key for this setting.
	JujuNoProxyKey = "juju-no-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"

	// AptNoProxyKey stores the key for this setting.
	AptNoProxyKey = "apt-no-proxy"

	// AptMirrorKey is used to set the apt mirror.
	AptMirrorKey = "apt-mirror"

	// SnapHTTPProxyKey is used to set the snap core setting proxy.http for deployed machines.
	SnapHTTPProxyKey = "snap-http-proxy"
	// SnapHTTPSProxyKey is used to set the snap core setting proxy.https for deployed machines.
	SnapHTTPSProxyKey = "snap-https-proxy"
	// SnapStoreProxyKey is used to set the snap core setting proxy.store for deployed machines.
	SnapStoreProxyKey = "snap-store-proxy"
	// SnapStoreAssertionsKey is used to configure the deployed machines to acknowledge the
	// store proxy assertions.
	SnapStoreAssertionsKey = "snap-store-assertions"
	// SnapStoreProxyURLKey is used to specify the URL to a snap store proxy.
	SnapStoreProxyURLKey = "snap-store-proxy-url"

	// NetBondReconfigureDelayKey is the key to pass when bridging
	// the network for containers.
	NetBondReconfigureDelayKey = "net-bond-reconfigure-delay"

	// ContainerNetworkingMethod is the key for setting up
	// networking method for containers.
	ContainerNetworkingMethod = "container-networking-method"

	// StorageDefaultBlockSourceKey is the key for the default block storage source.
	StorageDefaultBlockSourceKey = "storage-default-block-source"

	// StorageDefaultFilesystemSourceKey is the key for the default filesystem storage source.
	StorageDefaultFilesystemSourceKey = "storage-default-filesystem-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"

	// ExtraInfoKey is the key for arbitrary user specified string data that
	// is stored against the model.
	ExtraInfoKey = "extra-info"

	// MaxStatusHistoryAge is the maximum age of status history values
	// to keep when pruning, eg "72h"
	MaxStatusHistoryAge = "max-status-history-age"

	// MaxStatusHistorySize is the maximum size the status history
	// collection can grow to before it is pruned, eg "5M"
	MaxStatusHistorySize = "max-status-history-size"

	// MaxActionResultsAge is the maximum age of actions to keep when pruning, eg
	// "72h"
	MaxActionResultsAge = "max-action-results-age"

	// MaxActionResultsSize is the maximum size the actions collection can
	// grow to before it is pruned, eg "5M"
	MaxActionResultsSize = "max-action-results-size"

	// UpdateStatusHookInterval is how often to run the update-status hook.
	UpdateStatusHookInterval = "update-status-hook-interval"

	// EgressSubnets are the source addresses from which traffic from this model
	// originates if the model is deployed such that NAT or similar is in use.
	EgressSubnets = "egress-subnets"

	// FanConfig defines the configuration for FAN network running in the model.
	FanConfig = "fan-config"

	// CloudInitUserDataKey is the key to specify cloud-init yaml the user
	// wants to add into the cloud-config data produced by Juju when
	// provisioning machines.
	CloudInitUserDataKey = "cloudinit-userdata"

	// BackupDirKey specifies the backup working directory.
	BackupDirKey = "backup-dir"

	// ContainerInheritPropertiesKey is the key to specify a list of properties
	// to be copied from a machine to a container during provisioning. The
	// list will be comma separated.
	ContainerInheritPropertiesKey = "container-inherit-properties"

	// DefaultSpace specifies which space should be used for the default
	// endpoint bindings.
	DefaultSpace = "default-space"

	// LXDSnapChannel selects the channel to use when installing LXD from a snap.
	LXDSnapChannel = "lxd-snap-channel"

	// CharmHubURLKey is the key for the url to use for CharmHub API calls
	CharmHubURLKey = "charmhub-url"

	// ModeKey is the key for defining the mode that a given model should be
	// using.
	// It is expected that when in a different mode, Juju will perform in a
	// different state.
	ModeKey = "mode"

	// SSHAllowKey is a comma separated list of CIDRs from which machines in
	// this model will accept connections to the SSH service
	SSHAllowKey = "ssh-allow"

	// SAASIngressAllowKey is a comma separated list of CIDRs
	// specifying what ingress can be applied to offers in this model
	SAASIngressAllowKey = "saas-ingress-allow"

	// IgnoreMachineAddresses when true, will cause the
	// machine worker not to discover any machine addresses
	// on start up.
	IgnoreMachineAddresses = "ignore-machine-addresses"

	// TestModeKey is the key for identifying the model should be run in test
	// mode.
	TestModeKey = "test-mode"

	// DisableTelemetryKey is a key for determining whether telemetry on juju
	// models will be done.
	DisableTelemetryKey = "disable-telemetry"

	// LoggingOutputKey is a key for determining the destination of output for
	// logging.
	LoggingOutputKey = "logging-output"

	// DefaultSeriesKey is a key for determining the series a model should
	// explicitly use for charms unless otherwise provided.
	DefaultSeriesKey = "default-series"

	// DefaultBaseKey is a key for determining the base a model should
	// explicitly use for charms unless otherwise provided.
	DefaultBaseKey = "default-base"

	// SecretBackendKey is used to specify the secret backend.
	SecretBackendKey = "secret-backend"
)

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.

View Source
const (
	// DefaultStatusHistoryAge is the default value for MaxStatusHistoryAge.
	DefaultStatusHistoryAge = "336h" // 2 weeks

	// DefaultStatusHistorySize is the default value for MaxStatusHistorySize.
	DefaultStatusHistorySize = "5G"

	// DefaultUpdateStatusHookInterval is the default value for
	// UpdateStatusHookInterval
	DefaultUpdateStatusHookInterval = "5m"

	// DefaultActionResultsAge is the default for the age of the results for an
	// action.
	DefaultActionResultsAge = "336h" // 2 weeks

	// DefaultActionResultsSize is the default size of the action results.
	DefaultActionResultsSize = "5G"

	// DefaultLxdSnapChannel is the default lxd snap channel to install on host vms.
	DefaultLxdSnapChannel = "5.0/stable"

	// DefaultSecretBackend is the default secret backend to use.
	DefaultSecretBackend = "auto"
)
View Source
const (
	MaxNumProvisionWorkers          = 100
	MaxNumContainerProvisionWorkers = 25
)
View Source
const (
	// RequiresPromptsMode is used to tell clients interacting with
	// model that confirmation prompts are required when removing
	// potentially important resources
	RequiresPromptsMode = "requires-prompts"

	// StrictMode is currently unused
	// TODO(jack-w-shaw) remove this mode
	StrictMode = "strict"
)
View Source
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.

View Source
const (
	// JujuSystemKey is the SSH key comment for Juju system keys.
	JujuSystemKey = "juju-system-key"
)

Variables

View Source
var GetDefaultSupportedLTSBase = jujuversion.DefaultSupportedLTSBase

GetDefaultSupportedLTSBase returns the DefaultSupportedLTSBase. This is exposed for one reason and one reason only; testing! The fact that PreferredBase doesn't take an argument for a default base as a fallback. We then have to expose this so we can exercise the branching code for other scenarios makes me sad.

Functions

func AptProxyConfigMap

func AptProxyConfigMap(proxySettings proxy.Settings) map[string]interface{}

AptProxyConfigMap returns a map suitable to be applied to a Config to update proxy settings.

func CoerceForStorage

func CoerceForStorage(attrs map[string]interface{}) map[string]interface{}

CoerceForStorage transforms attributes prior to being saved in a persistent store.

func ConcatAuthKeys

func ConcatAuthKeys(a, b string) string

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 PreferredBase

func PreferredBase(cfg HasDefaultBase) corebase.Base

PreferredBase returns the preferred base to use when a charm does not explicitly specify a base.

func ProcessDeprecatedAttributes

func ProcessDeprecatedAttributes(attrs map[string]interface{}) map[string]interface{}

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

func ProxyConfigMap(proxySettings proxy.Settings) map[string]interface{}

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 Validate

func Validate(cfg, old *Config) error

Validate ensures that config is a valid configuration. If old is not nil, it holds the previous environment configuration for consideration when validating changes.

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

The attrs map can not be nil, otherwise a panic is raised.

func (*Config) AgentMetadataURL

func (c *Config) AgentMetadataURL() (string, bool)

AgentMetadataURL returns the URL that locates the agent tarballs and metadata, and whether it has been set.

func (*Config) AgentStream

func (c *Config) AgentStream() string

AgentStream returns the simplestreams stream used to identify which tools to use when bootstrapping or upgrading an environment.

func (*Config) AgentVersion

func (c *Config) AgentVersion() (version.Number, bool)

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) AllAttrs

func (c *Config) AllAttrs() map[string]interface{}

AllAttrs returns a copy of the raw configuration attributes.

func (*Config) Apply

func (c *Config) Apply(attrs map[string]interface{}) (*Config, error)

Apply returns a new configuration that has the attributes of c plus attrs.

func (*Config) AptFTPProxy

func (c *Config) AptFTPProxy() string

AptFTPProxy returns the apt ftp proxy for the model. Falls back to the default ftp-proxy if not specified.

func (*Config) AptHTTPProxy

func (c *Config) AptHTTPProxy() string

AptHTTPProxy returns the apt http proxy for the model. Falls back to the default http-proxy if not specified.

func (*Config) AptHTTPSProxy

func (c *Config) AptHTTPSProxy() string

AptHTTPSProxy returns the apt https proxy for the model. Falls back to the default https-proxy if not specified.

func (*Config) AptMirror

func (c *Config) AptMirror() string

AptMirror sets the apt mirror for the model.

func (*Config) AptNoProxy

func (c *Config) AptNoProxy() string

AptNoProxy returns the 'apt-no-proxy' for the model.

func (*Config) AptProxySettings

func (c *Config) AptProxySettings() proxy.Settings

AptProxySettings returns all three proxy settings; http, https and ftp.

func (*Config) AuthorizedKeys

func (c *Config) AuthorizedKeys() string

AuthorizedKeys returns the content for ssh's authorized_keys file.

func (*Config) AutomaticallyRetryHooks

func (c *Config) AutomaticallyRetryHooks() bool

AutomaticallyRetryHooks returns whether we should automatically retry hooks. By default this should be true.

func (*Config) BackupDir

func (c *Config) BackupDir() string

BackupDir returns the configuration string for the temporary files backup.

func (*Config) CharmHubURL

func (c *Config) CharmHubURL() (string, bool)

CharmHubURL returns the URL to use for CharmHub API calls.

func (*Config) CloudInitUserData

func (c *Config) CloudInitUserData() map[string]interface{}

CloudInitUserData returns a copy of the raw user data attributes that were specified by the user.

func (*Config) ContainerImageMetadataDefaultsDisabled

func (c *Config) ContainerImageMetadataDefaultsDisabled() bool

ContainerImageMetadataDefaultsDisabled returns whether or not default image metadata sources are disabled for containers. Useful for airgapped installations.

func (*Config) ContainerImageMetadataURL

func (c *Config) ContainerImageMetadataURL() (string, bool)

ContainerImageMetadataURL returns the URL at which the metadata used to locate container OS image ids is located, and whether it has been set.

func (*Config) ContainerImageStream

func (c *Config) ContainerImageStream() string

ContainerImageStream returns the simplestreams stream used to identify which image ids to search when starting a container.

func (*Config) ContainerInheritProperties

func (c *Config) ContainerInheritProperties() string

ContainerInheritProperties returns a copy of the raw user data keys that were specified by the user.

func (*Config) ContainerNetworkingMethod

func (c *Config) ContainerNetworkingMethod() string

ContainerNetworkingMethod returns the method with which containers network should be set up.

func (*Config) DefaultBase

func (c *Config) DefaultBase() (string, bool)

DefaultBase returns the configured default base for the model, and whether the default base was explicitly configured on the environment.

func (*Config) DefaultSpace

func (c *Config) DefaultSpace() string

DefaultSpace returns the name of the space for to be used for endpoint bindings that are not explicitly set.

func (*Config) Development

func (c *Config) Development() bool

Development returns whether the environment is in development mode.

func (*Config) DisableNetworkManagement

func (c *Config) DisableNetworkManagement() (bool, bool)

DisableNetworkManagement reports whether Juju is allowed to configure and manage networking inside the environment.

func (*Config) EgressSubnets

func (c *Config) EgressSubnets() []string

EgressSubnets are the source addresses from which traffic from this model originates if the model is deployed such that NAT or similar is in use.

func (*Config) EnableOSRefreshUpdate

func (c *Config) EnableOSRefreshUpdate() bool

EnableOSRefreshUpdate returns whether or not newly provisioned instances should run their respective OS's update capability.

func (*Config) EnableOSUpgrade

func (c *Config) EnableOSUpgrade() bool

EnableOSUpgrade returns whether or not newly provisioned instances should run their respective OS's upgrade capability.

func (*Config) FTPProxy

func (c *Config) FTPProxy() string

FTPProxy returns the legacy ftp proxy for the model.

func (*Config) FanConfig

func (c *Config) FanConfig() (network.FanConfig, error)

FanConfig is the configuration of FAN network running in the model.

func (*Config) FirewallMode

func (c *Config) FirewallMode() string

FirewallMode returns whether the firewall should manage ports per machine, globally, or not at all. (FwInstance, FwGlobal, or FwNone).

func (*Config) HTTPProxy

func (c *Config) HTTPProxy() string

HTTPProxy returns the legacy http proxy for the model.

func (*Config) HTTPSProxy

func (c *Config) HTTPSProxy() string

HTTPSProxy returns the legacy https proxy for the model.

func (*Config) HasJujuProxy

func (c *Config) HasJujuProxy() bool

HasJujuProxy returns true if there is any proxy set using the new juju-proxy keys.

func (*Config) HasLegacyProxy

func (c *Config) HasLegacyProxy() bool

HasLegacyProxy returns true if there is any proxy set using the old legacy proxy keys.

func (*Config) IgnoreMachineAddresses

func (c *Config) IgnoreMachineAddresses() (bool, bool)

IgnoreMachineAddresses reports whether Juju will discover and store machine addresses on startup.

func (*Config) ImageMetadataDefaultsDisabled

func (c *Config) ImageMetadataDefaultsDisabled() bool

ImageMetadataDefaultsDisabled returns whether or not default image metadata sources are disabled. Useful for airgapped installations.

func (*Config) ImageMetadataURL

func (c *Config) ImageMetadataURL() (string, bool)

ImageMetadataURL returns the URL at which the metadata used to locate image ids is located, and whether it has been set.

func (*Config) ImageStream

func (c *Config) ImageStream() string

ImageStream returns the simplestreams stream used to identify which image ids to search when starting an instance.

func (*Config) JujuFTPProxy

func (c *Config) JujuFTPProxy() string

JujuFTPProxy returns the ftp proxy for the model.

func (*Config) JujuHTTPProxy

func (c *Config) JujuHTTPProxy() string

JujuHTTPProxy returns the http proxy for the model.

func (*Config) JujuHTTPSProxy

func (c *Config) JujuHTTPSProxy() string

JujuHTTPSProxy returns the https proxy for the model.

func (*Config) JujuNoProxy

func (c *Config) JujuNoProxy() string

JujuNoProxy returns the 'no-proxy' for the model. This value can contain CIDR values.

func (*Config) JujuProxySettings

func (c *Config) JujuProxySettings() proxy.Settings

JujuProxySettings returns all four proxy settings that have been set using the juju- prefixed proxy settings. These values determine the current best practice for proxies.

func (*Config) LXDSnapChannel

func (c *Config) LXDSnapChannel() string

LXDSnapChannel returns the channel to be used when installing LXD from a snap.

func (*Config) LegacyProxySettings

func (c *Config) LegacyProxySettings() proxy.Settings

LegacyProxySettings returns all four proxy settings; http, https, ftp, and no proxy. These are considered legacy as using these values will cause the environment to be updated, which has shown to not work in many cases. It is being kept to avoid breaking environments where it is sufficient.

func (*Config) LogFwdSyslog

func (c *Config) LogFwdSyslog() (*syslog.RawConfig, bool)

LogFwdSyslog returns the syslog forwarding config.

func (*Config) LoggingConfig

func (c *Config) LoggingConfig() string

LoggingConfig returns the configuration string for the loggers.

func (*Config) LoggingOutput

func (c *Config) LoggingOutput() ([]string, bool)

LoggingOutput is a for determining the destination of output for logging.

func (*Config) MaxActionResultsAge

func (c *Config) MaxActionResultsAge() time.Duration

func (*Config) MaxActionResultsSizeMB

func (c *Config) MaxActionResultsSizeMB() uint

func (*Config) MaxStatusHistoryAge

func (c *Config) MaxStatusHistoryAge() time.Duration

MaxStatusHistoryAge is the maximum age of status history entries before being pruned.

func (*Config) MaxStatusHistorySizeMB

func (c *Config) MaxStatusHistorySizeMB() uint

MaxStatusHistorySizeMB is the maximum size in MiB which the status history collection can grow to before being pruned.

func (*Config) Mode

func (c *Config) Mode() (set.Strings, bool)

Mode returns a set of mode types for the configuration. Only one option exists at the moment ('requires-prompts')

func (*Config) Name

func (c *Config) Name() string

Name returns the model name.

func (*Config) NetBondReconfigureDelay

func (c *Config) NetBondReconfigureDelay() int

NetBondReconfigureDelay returns the duration in seconds that should be passed to the bridge script when bridging bonded interfaces.

func (*Config) NoProxy

func (c *Config) NoProxy() string

NoProxy returns the legacy 'no-proxy' for the model.

func (*Config) NumContainerProvisionWorkers

func (c *Config) NumContainerProvisionWorkers() int

NumContainerProvisionWorkers returns the number of container provisioner workers to use.

func (*Config) NumProvisionWorkers

func (c *Config) NumProvisionWorkers() int

NumProvisionWorkers returns the number of provisioner workers to use.

func (*Config) ProvisionerHarvestMode

func (c *Config) ProvisionerHarvestMode() HarvestMode

ProvisionerHarvestMode reports the harvesting methodology the provisioner should take.

func (*Config) ProxySSH

func (c *Config) ProxySSH() bool

ProxySSH returns a flag indicating whether SSH commands should be proxied through the API server.

func (*Config) Remove

func (c *Config) Remove(attrs []string) (*Config, error)

Remove returns a new configuration that has the attributes of c minus attrs.

func (*Config) ResourceTags

func (c *Config) ResourceTags() (map[string]string, bool)

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) SAASIngressAllow

func (c *Config) SAASIngressAllow() []string

SAASIngressAllow returns a slice of CIDRs specifying what ingress can be applied to offers in this model

func (*Config) SSHAllow

func (c *Config) SSHAllow() []string

SSHAllow returns a slice of CIDRs from which machines in this model will accept connections to the SSH service

func (*Config) SSLHostnameVerification

func (c *Config) SSLHostnameVerification() bool

SSLHostnameVerification returns weather the environment has requested SSL hostname verification to be enabled.

func (*Config) SecretBackend

func (c *Config) SecretBackend() string

SecretBackend returns the secret backend name.

func (*Config) SnapHTTPProxy

func (c *Config) SnapHTTPProxy() string

SnapHTTPProxy returns the snap http proxy for the model.

func (*Config) SnapHTTPSProxy

func (c *Config) SnapHTTPSProxy() string

SnapHTTPSProxy returns the snap https proxy for the model.

func (*Config) SnapProxySettings

func (c *Config) SnapProxySettings() proxy.Settings

SnapProxySettings returns the two proxy settings; http, and https.

func (*Config) SnapStoreAssertions

func (c *Config) SnapStoreAssertions() string

SnapStoreAssertions returns the snap store assertions for the model.

func (*Config) SnapStoreProxy

func (c *Config) SnapStoreProxy() string

SnapStoreProxy returns the snap store proxy for the model.

func (*Config) SnapStoreProxyURL

func (c *Config) SnapStoreProxyURL() string

SnapStoreProxyURL returns the snap store proxy URL for the model.

func (*Config) StorageDefaultBlockSource

func (c *Config) StorageDefaultBlockSource() (string, bool)

StorageDefaultBlockSource returns the default block storage source for the model.

func (*Config) StorageDefaultFilesystemSource

func (c *Config) StorageDefaultFilesystemSource() (string, bool)

StorageDefaultFilesystemSource returns the default filesystem storage source for the model.

func (*Config) Telemetry

func (c *Config) Telemetry() bool

Telemetry returns whether telemetry is enabled for the model.

func (*Config) TransmitVendorMetrics

func (c *Config) TransmitVendorMetrics() bool

TransmitVendorMetrics returns whether the controller sends charm-collected metrics in this model for anonymized aggregate analytics. By default this should be true.

func (*Config) Type

func (c *Config) Type() string

Type returns the model's cloud provider type.

func (*Config) UUID

func (c *Config) UUID() string

UUID returns the uuid for the model.

func (*Config) UnknownAttrs

func (c *Config) UnknownAttrs() map[string]interface{}

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) UpdateStatusHookInterval

func (c *Config) UpdateStatusHookInterval() time.Duration

UpdateStatusHookInterval is how often to run the charm update-status hook.

func (*Config) ValidateUnknownAttrs

func (c *Config) ValidateUnknownAttrs(extrafields 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 defines a constant for indicating of the default should be
	// used for the configuration.
	UseDefaults Defaulting = true
	// NoDefaults defines a constant for indicating that no defaults should be
	// used for the configuration.
	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 an application/model/unit.
	HarvestDestroyed
	// HarvestAll signifies that Juju should harvest both unknown and
	// destroyed instances. ♫ Don't fear the reaper. ♫
	HarvestAll = 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

HarvestDestroyed returns whether or not the Destroyed harvesting flag is set.

func (HarvestMode) HarvestNone

func (method HarvestMode) HarvestNone() bool

HarvestNone returns whether or not the None harvesting flag is set.

func (HarvestMode) HarvestUnknown

func (method HarvestMode) HarvestUnknown() bool

HarvestUnknown 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 HasDefaultBase

type HasDefaultBase interface {
	DefaultBase() (string, bool)
}

HasDefaultBase defines a interface if a type has a default base or not.

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.

Jump to

Keyboard shortcuts

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