bootstrap

package
v0.0.0-...-4bd6544 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2016 License: AGPL-3.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AdminSecretKey is the attribute key for the administrator password.
	AdminSecretKey = "admin-secret"

	// CACertKey is the attribute key for the controller's CA certificate.
	CACertKey = "ca-cert"

	// CAPrivateKeyKey is the key for the controller's CA certificate private key.
	CAPrivateKeyKey = "ca-private-key"

	// BootstrapTimeoutKey is the attribute key for the amount of time to wait
	// for bootstrap to complete.
	BootstrapTimeoutKey = "bootstrap-timeout"

	// BootstrapRetryDelayKey is the attribute key for the amount of time
	// in between attempts to connect to a bootstrap machine address.
	BootstrapRetryDelayKey = "bootstrap-retry-delay"

	// BootstrapAddressesDelayKey is the attribute key for the amount of
	// time in between refreshing the bootstrap machine addresses.
	BootstrapAddressesDelayKey = "bootstrap-addresses-delay"
)
View Source
const (

	// DefaultBootstrapSSHTimeout is the amount of time to wait
	// contacting a controller, in seconds.
	DefaultBootstrapSSHTimeout = 1200

	// DefaultBootstrapSSHRetryDelay is the amount of time between
	// attempts to connect to an address, in seconds.
	DefaultBootstrapSSHRetryDelay = 5

	// DefaultBootstrapSSHAddressesDelay is the amount of time betwee
	// refreshing the addresses, in seconds. Not too frequent, as we
	// refresh addresses from the provider each time.
	DefaultBootstrapSSHAddressesDelay = 10
)
View Source
const ControllerModelName = "controller"

ControllerModelName is the name of the admin model in each controller.

Variables

BootstrapConfigAttributes are attributes which may be defined by the user at bootstrap time, but should not be present in general controller config.

Functions

func Bootstrap

func Bootstrap(ctx environs.BootstrapContext, environ environs.Environ, args BootstrapParams) error

Bootstrap bootstraps the given environment. The supplied constraints are used to provision the instance, and are also set within the bootstrapped environment.

func IsBootstrapAttribute

func IsBootstrapAttribute(attr string) bool

IsBootstrapAttribute reports whether or not the specified attribute name is only relevant during bootstrap.

func Prepare

Prepare prepares a new controller based on the provided configuration. It is an error to prepare a controller if there already exists an entry in the client store with the same name.

Upon success, Prepare will update the ClientStore with the details of the controller, admin account, and admin model.

Types

type BootstrapParams

type BootstrapParams struct {
	// ModelConstraints are merged with the bootstrap constraints
	// to choose the initial instance, and will be stored in the
	// initial models' states.
	ModelConstraints constraints.Value

	// BootstrapConstraints are used to choose the initial instance.
	// BootstrapConstraints does not affect the model constraints.
	BootstrapConstraints constraints.Value

	// BootstrapSeries, if specified, is the series to use for the
	// initial bootstrap machine.
	BootstrapSeries string

	// BootstrapImage, if specified, is the image ID to use for the
	// initial bootstrap machine.
	BootstrapImage string

	// CloudName is the name of the cloud that Juju will be bootstrapped in.
	CloudName string

	// Cloud contains the properties of the cloud that Juju will be
	// bootstrapped in.
	Cloud cloud.Cloud

	// CloudRegion is the name of the cloud region that Juju will be bootstrapped in.
	CloudRegion string

	// CloudCredentialName is the name of the cloud credential that Juju will be
	// bootstrapped with. This may be empty, for clouds that do not require
	// credentials.
	CloudCredentialName string

	// CloudCredential contains the cloud credential that Juju will be
	// bootstrapped with. This may be nil, for clouds that do not require
	// credentialis.
	CloudCredential *cloud.Credential

	// ControllerConfig is the set of config attributes relevant
	// to a controller.
	ControllerConfig controller.Config

	// ControllerInheritedConfig is the set of config attributes to be shared
	// across all models in the same controller.
	ControllerInheritedConfig map[string]interface{}

	// RegionInheritedConfig holds region specific configuration attributes to
	// be shared across all models in the same controller on a particular
	// cloud.
	RegionInheritedConfig cloud.RegionConfig

	// HostedModelConfig is the set of config attributes to be overlaid
	// on the controller config to construct the initial hosted model
	// config.
	HostedModelConfig map[string]interface{}

	// Placement, if non-empty, holds an environment-specific placement
	// directive used to choose the initial instance.
	Placement string

	// BuildAgent reports whether we should build and upload the local agent
	// binary and override the environment's specified agent-version.
	// It is an error to specify BuildAgent with a nil BuildAgentTarball.
	BuildAgent bool

	// BuildAgentTarball, if non-nil, is a function that may be used to
	// build tools to upload. If this is nil, tools uploading will never
	// take place.
	BuildAgentTarball sync.BuildAgentTarballFunc

	// MetadataDir is an optional path to a local directory containing
	// tools and/or image metadata.
	MetadataDir string

	// AgentVersion, if set, determines the exact tools version that
	// will be used to start the Juju agents.
	AgentVersion *version.Number

	// GUIDataSourceBaseURL holds the simplestreams data source base URL
	// used to retrieve the Juju GUI archive installed in the controller.
	// If not set, the Juju GUI is not installed from simplestreams.
	GUIDataSourceBaseURL string

	// AdminSecret contains the administrator password.
	AdminSecret string

	// CAPrivateKey is the controller's CA certificate private key.
	CAPrivateKey string

	// DialOpts contains the bootstrap dial options.
	DialOpts environs.BootstrapDialOpts
}

BootstrapParams holds the parameters for bootstrapping an environment.

func (BootstrapParams) Validate

func (p BootstrapParams) Validate() error

Validate validates the bootstrap parameters.

type Config

type Config struct {
	AdminSecret             string
	CACert                  string
	CAPrivateKey            string
	BootstrapTimeout        time.Duration
	BootstrapRetryDelay     time.Duration
	BootstrapAddressesDelay time.Duration
}

Config contains bootstrap-specific configuration.

func NewConfig

func NewConfig(attrs map[string]interface{}) (Config, error)

NewConfig creates a new Config from the supplied attributes. Default values will be used where defaults are available.

If ca-cert or ca-private-key are not set, then we will check if ca-cert-path or ca-private-key-path are set, and read the contents. If none of those are set, we will look for files in well-defined locations: $JUJU_DATA/ca-cert.pem, and $JUJU_DATA/ca-private-key.pem. If none of these are set, an error is returned.

func (Config) Validate

func (c Config) Validate() error

Validate validates the controller configuration.

type PrepareParams

type PrepareParams struct {
	// ModelConfig contains the base configuration for the controller model.
	//
	// This includes the model name, cloud type, any user-supplied
	// configuration, config inherited from controller, and any defaults.
	ModelConfig map[string]interface{}

	// ControllerConfig is the configuration of the controller being prepared.
	ControllerConfig controller.Config

	// ControllerName is the name of the controller being prepared.
	ControllerName string

	// Cloud is the specification of the cloud that the controller is
	// being prepared for.
	Cloud environs.CloudSpec

	// CredentialName is the name of the credential to use to bootstrap.
	// This will be empty for auto-detected credentials.
	CredentialName string

	// AdminSecret contains the password for the admin user.
	AdminSecret string
}

PrepareParams contains the parameters for preparing a controller Environ for bootstrapping.

func (PrepareParams) Validate

func (p PrepareParams) Validate() error

Validate validates the PrepareParams.

Jump to

Keyboard shortcuts

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