Merge lp:~bac/juju-quickstart/add-gce into lp:juju-quickstart

Proposed by Brad Crittenden
Status: Merged
Approved by: Brad Crittenden
Approved revision: 134
Merged at revision: 130
Proposed branch: lp:~bac/juju-quickstart/add-gce
Merge into: lp:juju-quickstart
Diff against target: 146 lines (+95/-3)
2 files modified
quickstart/models/envs.py (+82/-3)
quickstart/tests/models/test_envs.py (+13/-0)
To merge this branch: bzr merge lp:~bac/juju-quickstart/add-gce
Reviewer Review Type Date Requested Status
Jay R. Wren (community) Approve
Richard Harding Approve
Review via email: mp+258250@code.launchpad.net

Commit message

Add support for Google Compute Engine
R=evarlast, rharding

Description of the change

Add support for Google Compute Engine

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

QA:

1) % make check

2) Run against GCE environment.

GCE requires you to have an account set up and a project must pre-exist before you can bootstrap with juju. Go to https://console.developers.google.com/project (be sure to login with the correct account, personal or Canonical) and set-up a project. You'll also need to go to the API setting and enable the Google Compute Engine API. Under 'Credentials', select 'Create new Client ID' which will download a JSON credentials file you will use later. Remember where you put it.

Run quickstart interactively:

(Set JUJU_HOME to be something novel if you don't want to mess up your real environments.yaml file.)

% devenv/bin/juju-quickstart -i

In the 'Create a new environment' section select Google Compute Engine and flesh it out.

Ensure the environment bootstraps and the $JUJU_HOME/environments.yaml file looks good.

Revision history for this message
Richard Harding (rharding) wrote :

Code is LGTM without any QA at the moment. A couple of questions though before going on.

review: Approve
lp:~bac/juju-quickstart/add-gce updated
132. By Brad Crittenden

Update Azure locations

133. By Brad Crittenden

Update EC2 regions

134. By Brad Crittenden

Updated GCE auth file description per review.

Revision history for this message
Jay R. Wren (evarlast) wrote :

QA with ./juju-quickstart works great with my environments.yaml which had North Central US as my azure location.

eu-central AWS works and gets passed to juju find too.

I don't have a GCE account with which to test the GCE things.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'quickstart/models/envs.py'
2--- quickstart/models/envs.py 2015-04-30 14:46:42 +0000
3+++ quickstart/models/envs.py 2015-05-05 14:45:54 +0000
4@@ -414,15 +414,39 @@
5 'simplestreams).',
6 suggestions=['released', 'daily'])
7 # Define data structures used as part of the metadata below.
8+
9+ # The up-to-date list of EC2 regions can be found at:
10+ # http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/
11+ # using-regions-availability-zones.html
12 ec2_regions = (
13 'ap-northeast-1', 'ap-southeast-1', 'ap-southeast-2',
14- 'eu-west-1', 'sa-east-1',
15+ 'eu-central-1', 'eu-west-1', 'sa-east-1',
16 'us-east-1', 'us-west-1', 'us-west-2',
17 )
18 hp_regions = ('region-a.geo-1', 'region-b.geo-1')
19+
20+ # The Azure locations are listed at:
21+ # http://azure.microsoft.com/en-us/regions/
22 azure_locations = (
23- 'East US', 'West US', 'West Europe', 'North Europe',
24- 'Southeast Asia', 'East Asia')
25+ 'Central US',
26+ 'East US',
27+ 'East US 2',
28+ 'US Gov Iowa',
29+ 'US Gov Virginia',
30+ 'North Central US',
31+ 'South Central US',
32+ 'West US',
33+ 'North Europe',
34+ 'West Europe',
35+ 'East Asia',
36+ 'Southeast Asia',
37+ 'Japan East',
38+ 'Japan West',
39+ 'Brazil South',
40+ 'Australia East',
41+ 'Australia Southeast',
42+ )
43+
44 # The first URL is used as the default one.
45 joyent_sdc_urls = (
46 'https://us-west-1.api.joyentcloud.com',
47@@ -430,6 +454,17 @@
48 'https://us-sw-1.api.joyentcloud.com',
49 'https://us-ams-1.api.joyentcloud.com',
50 )
51+ # The first is the default.
52+ gce_regions = (
53+ 'us-central1',
54+ 'europe-west1',
55+ 'asia-east1',
56+ )
57+ # The first URL is used as the default one.
58+ gce_image_endpoints = (
59+ 'https://www.googleapis.com',
60+ )
61+
62 # Define the env_type_db dictionary: this is done inside this function in
63 # order to avoid instantiating fields at import time.
64 # This is an ordered dict so that views can expose options to create new
65@@ -683,6 +718,50 @@
66 is_default_field,
67 ),
68 }
69+ env_type_db['gce'] = {
70+ 'label': 'Google Compute Engine',
71+ 'description': (
72+ 'The gce provider enables you to run Juju on Google '
73+ 'Compute Engine. '
74+ 'This process requires you to have a Google account '
75+ 'and a pre-existing project. Visit '
76+ 'https://console.developers.google.com/project '
77+ 'to set up your project and download credentials '
78+ 'before continuing.'),
79+ 'fields': (
80+ provider_field,
81+ name_field,
82+ # SDC fields.
83+ fields.StringField(
84+ 'project-id', required=True,
85+ label='project id',
86+ help='the pre-existing GCE project id. '),
87+ fields.FilePathField(
88+ 'auth-file', required=True,
89+ label='authorization file',
90+ help=(
91+ 'the path to the GCE project authorization '
92+ 'JSON file from creating a new client id: '
93+ 'https://console.developers.google.com/project/'
94+ '<project-id>/apiui/credential'),
95+ ),
96+ fields.ChoiceField(
97+ 'region', choices=gce_regions, label='region',
98+ required=False, default=gce_regions[0],
99+ help='the GCE region to use'),
100+ fields.ChoiceField(
101+ 'image-endpoint', choices=gce_image_endpoints,
102+ label='image endpoint',
103+ required=False, default=gce_image_endpoints[0],
104+ help=(
105+ 'the GCE image endpoint where Juju will look '
106+ 'for disk images when provisioning a '
107+ 'new instance on GCE'),
108+ ),
109+ default_series_field,
110+ is_default_field,
111+ ),
112+ }
113 env_type_db['maas'] = {
114 'label': 'MAAS (bare metal)',
115 'description': (
116
117=== modified file 'quickstart/tests/models/test_envs.py'
118--- quickstart/tests/models/test_envs.py 2015-04-30 14:50:56 +0000
119+++ quickstart/tests/models/test_envs.py 2015-05-05 14:45:54 +0000
120@@ -763,6 +763,18 @@
121 self.assert_fields(expected, env_metadata)
122 self.assert_required_fields(expected_required, env_metadata)
123
124+ def test_gce_environment(self):
125+ # The GCE environment metadata includes the expected fields.
126+ self.assertIn('gce', self.env_type_db)
127+ env_metadata = self.env_type_db['gce']
128+ expected = [
129+ 'type', 'name', 'project-id', 'auth-file', 'region',
130+ 'image-endpoint', 'default-series', 'is-default']
131+ expected_required = [
132+ 'type', 'name', 'project-id', 'auth-file', 'is-default']
133+ self.assert_fields(expected, env_metadata)
134+ self.assert_required_fields(expected_required, env_metadata)
135+
136 def test_maas_environment(self):
137 # The MAAS environment metadata includes the expected fields.
138 self.assertIn('maas', self.env_type_db)
139@@ -802,6 +814,7 @@
140 ('openstack', 'OpenStack (or HP Public Cloud)'),
141 ('azure', 'Windows Azure'),
142 ('joyent', 'Joyent'),
143+ ('gce', 'Google Compute Engine'),
144 ('maas', 'MAAS (bare metal)'),
145 ('manual', 'Manual Provisioning'),
146 ('local', 'local (LXC)'),

Subscribers

People subscribed via source and target branches