Skip to content

Commit a8e4fe5

Browse files
committed
Merge pull request #3631 from sedouard/feat_create_discovery_url
feat(contrib/azure/azure-coreos-cluster): automatically create discovery url
2 parents d5a1233 + 85a48cd commit a8e4fe5

2 files changed

Lines changed: 12 additions & 16 deletions

File tree

contrib/azure/azure-coreos-cluster

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ parser.add_argument('--data-disk', action='store_true',
5555
help='optional, attaches a data disk to each VM')
5656
parser.add_argument('--nohttps', action='store_true',
5757
help='optional, disables the creation of the https load balanced endpoint')
58+
parser.add_argument('--no-discovery-url', action='store_true',
59+
help='optional, disables the creation of a new coreos discovery url')
60+
5861
cloud_init_template = """#cloud-config
5962
6063
coreos:
@@ -85,6 +88,11 @@ if not args.ssh_cert and not args.ssh_thumb:
8588
args.ssh_cert = './ssh-cert.cer'
8689
print 'Generated SSH certificate with thumbprint ' + args.ssh_thumb
8790

91+
# generate coreos discovery url
92+
if not args.no_discovery_url:
93+
print 'Generating new CoreOS discovery URL for the cluster'
94+
subprocess.call(['bash', '-c', 'python ./create-azure-user-data $(curl -s https://discovery.etcd.io/new)'])
95+
8896
# Setup custom data
8997
if args.custom_data:
9098
with open(args.custom_data, 'r') as f:
@@ -163,8 +171,7 @@ def network_config(subnet_name=None, port='59913', public_ip_name=None):
163171
if not args.nohttps:
164172
network.input_endpoints.input_endpoints.append(lb_endpoint_config('https', '443', load_balancer_probe(None, '443', 'tcp')))
165173
# create builder endpoint TCP probe check and extended timeout
166-
network.input_endpoints.input_endpoints.append(lb_endpoint_config('builder', '2222',
167-
load_balancer_probe(None, '2222', 'tcp',), 20))
174+
network.input_endpoints.input_endpoints.append(lb_endpoint_config('builder', '2222', load_balancer_probe(None, '2222', 'tcp',), 20))
168175
return network
169176

170177
def data_hd(target_container_url, target_blob_name, target_lun, target_disk_size_in_gb):

docs/installing_deis/azure.rst

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,6 @@ Azure portal's Settings.
4747

4848
Also copy the Azure subscription id from this table and save it for the cluster creation script below.
4949

50-
Create Cluster Cloud Config
51-
---------------------------
52-
53-
Before we can create a cluster, we need to create a cloud config for it. The script
54-
``create-azure-user-data`` does this for you. This script takes the stock cluster instance config
55-
in ``../coreos/user-data.example``, customizes it for Azure, and inserts a unique cluster discovery
56-
endpoint:
57-
58-
.. code-block:: console
59-
60-
$ ./create-azure-user-data $(curl -s https://discovery.etcd.io/new)
61-
62-
This will create a azure-user-data cloud config file. We'll use this with the script in the next
63-
section during cluster creation.
6450

6551
Create CoreOS Cluster
6652
---------------------
@@ -71,6 +57,9 @@ With the management certificate and cloud config in place, we are ready to creat
7157
* Choose a cloud service name for your Deis cluster for the script below. The script will automatically create this cloud service for you.
7258
* Create an `affinity group`_ if you already don't have one. Supply it in quotes with the ``--affinity-group`` parameter. Although *using an affinity group is not mandatory*, it is **highly recommended** since it tells the Azure fabric to place all VMs in the cluster physically close to each other, reducing inter-node latency by a great deal. If you don't want ot use affinity groups, specify a `region`_ for Azure to use with a ``--location`` parameter. The default is ``"West US"``. If you specify both parameters, ``location`` will be ignored. Please note that the script *will not* create an affinity group by itself; it expects the affinity group exists.
7359

60+
This script calls the ``./create-azure-user-data`` script which takes the stock cluster instance config in ``../coreos/user-data.example``, customizes it for Azure, and inserts a unique cluster discovery
61+
endpoint. It will then use the newly created CoreOS config on the newly provisioned cluster.
62+
7463
With that, let's run the azure-coreos-cluster script which will create the CoreOS cluster. Fill in the bracketed values with the values for your deployment you created above.
7564

7665
.. code-block:: console

0 commit comments

Comments
 (0)