coreos/azure: Simplify etcd, use Weave 0.10.0

This commit is contained in:
Ilya Dmitrichenko 2015-04-22 15:11:23 +01:00
parent 2532fe56c3
commit d8f839bb72
3 changed files with 10 additions and 24 deletions

View File

@ -32,14 +32,14 @@ coreos:
Description=etcd 2
Documentation=https://github.com/coreos/etcd/
[Service]
Environment=ETCD_NAME=%host%
Environment=ETCD_NAME=%H
Environment=ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster
Environment=ETCD_INITIAL_ADVERTISE_PEER_URLS=http://%host%:2380
Environment=ETCD_LISTEN_PEER_URLS=http://%host%:2380
Environment=ETCD_INITIAL_ADVERTISE_PEER_URLS=http://%H:2380
Environment=ETCD_LISTEN_PEER_URLS=http://%H:2380
Environment=ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379,http://0.0.0.0:4001
Environment=ETCD_ADVERTISE_CLIENT_URLS=http://%host%:2379,http://%host%:4001
Environment=ETCD_INITIAL_CLUSTER=%cluster%
Environment=ETCD_ADVERTISE_CLIENT_URLS=http://%H:2379,http://%H:4001
Environment=ETCD_INITIAL_CLUSTER_STATE=new
Environment=ETCD_INITIAL_CLUSTER=etcd-00=http://etcd-00:2380,etcd-01=http://etcd-01:2380,etcd-02=http://etcd-02:2380
ExecStart=/opt/bin/etcd2
Restart=always
RestartSec=10

View File

@ -120,7 +120,7 @@ coreos:
Before=weave-helper.service
Before=docker.service
Description=Install Weave
Documentation=http://zettio.github.io/weave/
Documentation=http://weaveworks.github.io/weave/
Requires=network-online.target
[Service]
Type=oneshot
@ -129,7 +129,7 @@ coreos:
ExecStartPre=/usr/bin/curl \
--silent \
--location \
https://github.com/weaveworks/weave/releases/download/v0.9.0/weave \
https://github.com/weaveworks/weave/releases/download/latest_release/weave \
--output /opt/bin/weave
ExecStartPre=/usr/bin/curl \
--silent \
@ -150,7 +150,7 @@ coreos:
After=install-weave.service
After=docker.service
Description=Weave Network Router
Documentation=http://zettio.github.io/weave/
Documentation=http://weaveworks.github.io/weave/
Requires=docker.service
Requires=install-weave.service
[Service]
@ -165,13 +165,12 @@ coreos:
After=install-weave.service
After=docker.service
Description=Weave Network Router
Documentation=http://zettio.github.io/weave/
Documentation=http://weaveworks.github.io/weave/
Requires=docker.service
Requires=install-weave.service
[Service]
EnvironmentFile=/etc/weave.%H.env
ExecStartPre=/usr/bin/docker pull zettio/weave:latest
ExecStartPre=/usr/bin/docker pull zettio/weavetools:latest
ExecStartPre=/opt/bin/weave setup
ExecStartPre=/opt/bin/weave launch $WEAVE_PEERS
ExecStart=/usr/bin/docker attach weave
Restart=on-failure

View File

@ -8,23 +8,10 @@ var cloud_config = require('../cloud_config.js');
exports.create_etcd_cloud_config = function (node_count, conf) {
var input_file = './cloud_config_templates/kubernetes-cluster-etcd-node-template.yml';
var peers = [ ];
for (var i = 0; i < node_count; i++) {
peers.push(util.hostname(i, 'etcd') + '=http://' + util.hostname(i, 'etcd') + ':2380');
}
var cluster = peers.join(',');
return _(node_count).times(function (n) {
var output_file = util.join_output_file_path('kubernetes-cluster-etcd-node-' + n, 'generated.yml');
return cloud_config.process_template(input_file, output_file, function(data) {
for (var i = 0; i < data.coreos.units.length; i++) {
var unit = data.coreos.units[i];
if (unit.name === 'etcd2.service') {
unit.content = _.replaceAll(_.replaceAll(unit.content, '%host%', util.hostname(n, 'etcd')), '%cluster%', cluster);
break;
}
}
return data;
});
});