43
43
"vsphere": feature.VSphereProvider,
46
const bootstrapDoc = `
47
bootstrap starts a new controller in the specified cloud (it will return
48
an error if a controller with the same name has already been bootstrapped).
49
Bootstrapping a controller will provision a new machine and run the controller on
52
The controller will be setup with an intial controller model called "admin" as well
53
as a hosted model which can be used to run workloads.
55
If boostrap-constraints are specified in the bootstrap command,
56
they will apply to the machine provisioned for the juju controller,
57
and any future controllers provisioned for HA.
59
If constraints are specified, they will be set as the default constraints
60
on the model for all future workload machines,
61
exactly as if the constraints were set with juju set-constraints.
46
var usageBootstrapSummary = `
47
Initializes a cloud environment.`[1:]
49
var usageBootstrapDetails = `
50
Initialization consists of creating an 'admin' model and provisioning a
51
machine to act as controller.
52
Credentials are set beforehand and are distinct from any other
53
configuration (see `[1:] + "`juju add-credential`" + `).
54
The 'admin' model typically does not run workloads. It should remain
55
pristine to run and manage Juju's own infrastructure for the corresponding
56
cloud. Additional (hosted) models should be created with ` + "`juju create-\nmodel`" + ` for workload purposes.
57
Note that a 'default' model is also created and becomes the current model
58
of the environment once the command completes. It can be discarded if
59
other models are created.
60
If '--bootstrap-constraints' is used, its values will also apply to any
61
future controllers provisioned for high availability (HA).
62
If '--constraints' is used, its values will be set as the default
63
constraints for all future workload machines in the model, exactly as if
64
the constraints were set with ` + "`juju set-model-constraints`" + `.
63
65
It is possible to override constraints and the automatic machine selection
64
algorithm by using the "--to" flag. The value associated with "--to" is a
65
"placement directive", which tells Juju how to identify the first machine to use.
66
For more information on placement directives, see "juju help placement".
68
Bootstrap initialises the cloud environment synchronously and displays information
69
about the current installation steps. The time for bootstrap to complete varies
70
across cloud providers from a few seconds to several minutes. Once bootstrap has
71
completed, you can run other juju commands against your model. You can change
72
the default timeout and retry delays used during the bootstrap by changing the
73
following settings in your environments.yaml (all values represent number of seconds):
66
algorithm by assigning a "placement directive" via the '--to' option. This
67
dictates what machine to use for the controller. This would typically be
68
used with the MAAS provider ('--to <host>.maas').
69
You can change the default timeout and retry delays used during the
70
bootstrap by changing the following settings in your configuration file
71
(all values represent number of seconds):
75
72
# How long to wait for a connection to the controller
76
73
bootstrap-timeout: 600 # default: 10 minutes
77
# How long to wait between connection attempts to a controller address.
74
# How long to wait between connection attempts to a controller
78
76
bootstrap-retry-delay: 5 # default: 5 seconds
79
77
# How often to refresh controller addresses from the API server.
80
78
bootstrap-addresses-delay: 10 # default: 10 seconds
82
Private clouds may need to specify their own custom image metadata, and
83
possibly upload Juju tools to cloud storage if no outgoing Internet access is
84
available. In this case, use the --metadata-source parameter to point
85
bootstrap to a local directory from which to upload tools and/or image
88
If agent-version is specifed, this is the default tools version to use when running the Juju agents.
89
Only the numeric version is relevant. To enable ease of scripting, the full binary version
90
is accepted (eg 1.24.4-trusty-amd64) but only the numeric version (eg 1.24.4) is used.
91
By default, Juju will bootstrap using the exact same version as the client.
99
juju help set-constraints
79
Private clouds may need to specify their own custom image metadata and
80
tools/agent. Use '--metadata-source' whose value is a local directory.
81
The value of '--agent-version' will become the default tools version to
82
use in all models for this controller. The full binary version is accepted
83
(e.g.: 2.0.1-xenial-amd64) but only the numeric version (e.g.: 2.0.1) is
84
used. Otherwise, by default, the version used is that of the client.
87
juju bootstrap mycontroller google
88
juju bootstrap --config=~/config-rs.yaml mycontroller rackspace
89
juju bootstrap --config agent-version=1.25.3 mycontroller aws
90
juju bootstrap --config bootstrap-timeout=1200 mycontroller azure
103
97
// defaultHostedModelName is the name of the hosted model created in each
104
98
// controller for deploying workloads to, in addition to the "admin" model.
140
134
func (c *bootstrapCommand) Info() *cmd.Info {
141
135
return &cmd.Info{
142
136
Name: "bootstrap",
143
Purpose: "start up an environment from scratch",
144
Args: "<controllername> <cloud>[/<region>]",
137
Args: "<controller name> <cloud name>[/region]",
138
Purpose: usageBootstrapSummary,
139
Doc: usageBootstrapDetails,
149
143
func (c *bootstrapCommand) SetFlags(f *gnuflag.FlagSet) {
150
f.Var(constraints.ConstraintsValue{Target: &c.Constraints}, "constraints", "set model constraints")
151
f.Var(constraints.ConstraintsValue{Target: &c.BootstrapConstraints}, "bootstrap-constraints", "specify bootstrap machine constraints")
152
f.StringVar(&c.BootstrapSeries, "bootstrap-series", "", "specify the series of the bootstrap machine")
144
f.Var(constraints.ConstraintsValue{Target: &c.Constraints}, "constraints", "Set model constraints")
145
f.Var(constraints.ConstraintsValue{Target: &c.BootstrapConstraints}, "bootstrap-constraints", "Specify bootstrap machine constraints")
146
f.StringVar(&c.BootstrapSeries, "bootstrap-series", "", "Specify the series of the bootstrap machine")
153
147
if featureflag.Enabled(feature.ImageMetadata) {
154
f.StringVar(&c.BootstrapImage, "bootstrap-image", "", "specify the image of the bootstrap machine")
148
f.StringVar(&c.BootstrapImage, "bootstrap-image", "", "Specify the image of the bootstrap machine")
156
f.BoolVar(&c.UploadTools, "upload-tools", false, "upload local version of tools before bootstrapping")
157
f.StringVar(&c.MetadataSource, "metadata-source", "", "local path to use as tools and/or metadata source")
158
f.StringVar(&c.Placement, "to", "", "a placement directive indicating an instance to bootstrap")
159
f.BoolVar(&c.KeepBrokenEnvironment, "keep-broken", false, "do not destroy the model if bootstrap fails")
160
f.BoolVar(&c.AutoUpgrade, "auto-upgrade", false, "upgrade to the latest patch release tools on first bootstrap")
161
f.StringVar(&c.AgentVersionParam, "agent-version", "", "the version of tools to use for Juju agents")
162
f.StringVar(&c.CredentialName, "credential", "", "the credentials to use when bootstrapping")
163
f.Var(&c.config, "config", "specify a controller config file, or one or more controller configuration options (--config config.yaml [--config k=v ...])")
164
f.StringVar(&c.hostedModelName, "d", defaultHostedModelName, "the name of the default hosted model for the controller")
165
f.StringVar(&c.hostedModelName, "default-model", defaultHostedModelName, "the name of the default hosted model for the controller")
166
f.BoolVar(&c.noGUI, "no-gui", false, "do not install the Juju GUI in the controller when bootstrapping")
150
f.BoolVar(&c.UploadTools, "upload-tools", false, "Upload local version of tools before bootstrapping")
151
f.StringVar(&c.MetadataSource, "metadata-source", "", "Local path to use as tools and/or metadata source")
152
f.StringVar(&c.Placement, "to", "", "Placement directive indicating an instance to bootstrap")
153
f.BoolVar(&c.KeepBrokenEnvironment, "keep-broken", false, "Do not destroy the model if bootstrap fails")
154
f.BoolVar(&c.AutoUpgrade, "auto-upgrade", false, "Upgrade to the latest patch release tools on first bootstrap")
155
f.StringVar(&c.AgentVersionParam, "agent-version", "", "Version of tools to use for Juju agents")
156
f.StringVar(&c.CredentialName, "credential", "", "Credentials to use when bootstrapping")
157
f.Var(&c.config, "config", "Specify a controller configuration file, or one or more configuration\n options\n (--config config.yaml [--config key=value ...])")
158
f.StringVar(&c.hostedModelName, "d", defaultHostedModelName, "Name of the default hosted model for the controller")
159
f.StringVar(&c.hostedModelName, "default-model", defaultHostedModelName, "Name of the default hosted model for the controller")
160
f.BoolVar(&c.noGUI, "no-gui", false, "Do not install the Juju GUI in the controller when bootstrapping")
169
163
func (c *bootstrapCommand) Init(args []string) (err error) {