Skip to content

Commit

Permalink
Create Azure storage account if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
errordeveloper committed Mar 10, 2015
1 parent 1f4474c commit 2510f89
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ azure.create_config('kubernetes', { 'etcd': 3, 'kube': 3 });

azure.run_task_queue([
azure.queue_default_network(),
azure.queue_storage_if_needed(),
azure.queue_machines('etcd', 'stable',
kube.create_etcd_cloud_config),
azure.queue_machines('kube', 'stable',
Expand Down
19 changes: 19 additions & 0 deletions docs/getting-started-guides/coreos/azure/lib/azure_wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,22 @@ exports.queue_default_network = function () {
'--address-space=172.16.0.0',
conf.resources['vnet'],
]);
}

exports.queue_storage_if_needed = function() {
if (!process.env['AZURE_STORAGE_ACCOUNT']) {
conf.storage_account = util.rand_suffix;
task_queue.push([
'storage', 'account', 'create',
get_location(),
conf.storage_account,
]);
process.env['AZURE_STORAGE_ACCOUNT'] = conf.storage_account;
} else {
// Preserve it for resizing, so we don't create a new one by accedent,
// when the environment variable is unset
conf.storage_account = process.env['AZURE_STORAGE_ACCOUNT'];
}
};

exports.queue_machines = function (name_prefix, coreos_update_channel, cloud_config_creator) {
Expand Down Expand Up @@ -232,6 +248,8 @@ exports.destroy_cluster = function (state_file) {

task_queue.push(['network', 'vnet', 'delete', '--quiet', conf.resources['vnet']]);

// TODO: add storage deletion when AZURE_STORAGE_ACCOUNT is unset (depends on Azure/azure-xplat-cli#1615)

exports.run_task_queue();
};

Expand All @@ -247,4 +265,5 @@ exports.load_state_for_resizing = function (state_file, node_type, new_nodes) {
conf.nodes[node_type] += new_nodes;
hosts.collection = conf.hosts;
hosts.ssh_port_counter += conf.hosts.length;
process.env['AZURE_STORAGE_ACCOUNT'] = conf.storage_account;
}
2 changes: 1 addition & 1 deletion docs/getting-started-guides/coreos/azure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "Ilya Dmitrichenko <errordeveloper@gmail.com>",
"license": "Apache 2.0",
"dependencies": {
"azure-cli": "^0.8.14",
"azure-cli": "^0.8.15",
"colors": "^1.0.3",
"js-yaml": "^3.2.5",
"openssl-wrapper": "^0.2.1",
Expand Down

0 comments on commit 2510f89

Please sign in to comment.