Skip to content

Commit

Permalink
Fix #675 - Move to etcd production cluster setup where slaves/bastion…
Browse files Browse the repository at this point in the history
… are etcd proxy nodes and master has the etcd control plane
  • Loading branch information
tayzlor committed Mar 9, 2016
1 parent 168e8cf commit 95231ef
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 50 deletions.
16 changes: 7 additions & 9 deletions terraform/aws/private-cloud/bastion-cloud-config.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@

coreos:
etcd2:
# $private_ipv4 is populated by the cloud provider
# we don't have a $public_ipv4 in the private VPC
advertise-client-urls: http://$private_ipv4:2379,http://$private_ipv4:4001
initial-advertise-peer-urls: http://$private_ipv4:2380
# listen on both the official ports and the legacy ports
# legacy ports can be omitted if your application doesn't depend on them
proxy: on
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
listen-peer-urls: http://$private_ipv4:2380,http://$private_ipv4:7001
# Discovery is populated by Terraform
discovery: ${etcd_discovery_url}
fleet:
metadata: "role=bastion,region=${region}"
etcd_servers: "http://localhost:2379"
locksmith:
endpoint: "http://localhost:2379"
units:
- name: docker.service
command: start
- name: etcd2.service
command: start
update:
reboot-strategy: "reboot"
reboot-strategy: best-effort
manage_etc_hosts: localhost
3 changes: 2 additions & 1 deletion terraform/aws/private-cloud/bastion-server.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ resource "template_file" "bastion_cloud_init" {
depends_on = ["template_file.etcd_discovery_url"]
vars {
etcd_discovery_url = "${file(var.etcd_discovery_url_file)}"
size = "${var.masters + var.slaves + 1}"
size = "${var.masters}"
vpc_cidr_block = "${var.vpc_cidr_block}"
region = "${var.region}"
}
}

Expand Down
4 changes: 2 additions & 2 deletions terraform/aws/private-cloud/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ module "elb" {
resource "template_file" "etcd_discovery_url" {
template = "/dev/null"
provisioner "local-exec" {
command = "curl https://discovery.etcd.io/new?size=${var.masters + var.slaves} > ${var.etcd_discovery_url_file}"
command = "curl https://discovery.etcd.io/new?size=${var.masters} > ${var.etcd_discovery_url_file}"
}
# This will regenerate the discovery URL if the cluster size changes, we include the bastion here
vars {
size = "${var.masters + var.slaves + 1}"
size = "${var.masters}"
}
}
Expand Down
4 changes: 3 additions & 1 deletion terraform/aws/private-cloud/master-cloud-config.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ coreos:
listen-peer-urls: http://$private_ipv4:2380,http://$private_ipv4:7001
# Discovery is populated by Terraform
discovery: ${etcd_discovery_url}
fleet:
metadata: "role=master,region=${region}"
units:
- name: etcd2.service
command: start
update:
reboot-strategy: "reboot"
reboot-strategy: best-effort
manage_etc_hosts: localhost
3 changes: 2 additions & 1 deletion terraform/aws/private-cloud/mesos-masters.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ resource "template_file" "master_cloud_init" {
depends_on = ["template_file.etcd_discovery_url"]
vars {
etcd_discovery_url = "${file(var.etcd_discovery_url_file)}"
size = "${var.masters + var.slaves + 1}"
size = "${var.masters}"
region = "${var.region}"
}
}

Expand Down
3 changes: 2 additions & 1 deletion terraform/aws/private-cloud/mesos-slaves.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ resource "template_file" "slave_cloud_init" {
depends_on = ["template_file.etcd_discovery_url"]
vars {
etcd_discovery_url = "${file(var.etcd_discovery_url_file)}"
size = "${var.masters + var.slaves + 1}"
size = "${var.masters}"
region = "${var.region}"
}
}

Expand Down
12 changes: 5 additions & 7 deletions terraform/aws/private-cloud/slave-cloud-config.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,18 @@ coreos:
After=var-lib-docker.mount
Requires=var-lib-docker.mount
etcd2:
# $public_ipv4 and $private_ipv4 are populated by the cloud provider
advertise-client-urls: http://$public_ipv4:2379
initial-advertise-peer-urls: http://$private_ipv4:2380
proxy: on
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
listen-peer-urls: http://$private_ipv4:2380,http://$private_ipv4:7001
# Discovery is populated by Terraform
discovery: ${etcd_discovery_url}
fleet:
metadata: "role=slave,region=${region}"
public-ip: "$public_ipv4"
etcd_servers: "http://localhost:2379"
locksmith:
endpoint: "http://localhost:2379"
units:
- name: etcd2.service
command: start
- name: fleet.service
command: start
update:
reboot-strategy: best-effort
manage_etc_hosts: localhost
2 changes: 1 addition & 1 deletion terraform/aws/public-cloud/etcd_discovery_url.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://discovery.etcd.io/fafb16ac572cae5895c6523e7b3bd640
https://discovery.etcd.io/b71ce210f55ced2fcbad6d6c455098b5
4 changes: 2 additions & 2 deletions terraform/aws/public-cloud/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ module "elb" {
resource "template_file" "etcd_discovery_url" {
template = "/dev/null"
provisioner "local-exec" {
command = "curl https://discovery.etcd.io/new?size=${var.masters + var.slaves} > ${var.etcd_discovery_url_file}"
command = "curl https://discovery.etcd.io/new?size=${var.masters} > ${var.etcd_discovery_url_file}"
}
# This will regenerate the discovery URL if the cluster size changes
vars {
size = "${var.masters + var.slaves}"
size = "${var.masters}"
}
}
Expand Down
2 changes: 1 addition & 1 deletion terraform/aws/public-cloud/master-cloud-config.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ coreos:
initial-advertise-peer-urls: http://$private_ipv4:2380
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
listen-peer-urls: http://$private_ipv4:2380,http://$private_ipv4:7001
# Discovery is populated by Terraform
discovery: ${etcd_discovery_url}
fleet:
metadata: "role=master,region=${region}"
public-ip: "$public_ipv4"
units:
- name: etcd2.service
Expand Down
3 changes: 2 additions & 1 deletion terraform/aws/public-cloud/mesos-masters.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ resource "template_file" "master_cloud_init" {
depends_on = ["template_file.etcd_discovery_url"]
vars {
etcd_discovery_url = "${file(var.etcd_discovery_url_file)}"
size = "${var.masters + var.slaves}"
size = "${var.masters}"
region = "${var.region}"
}
}

Expand Down
3 changes: 2 additions & 1 deletion terraform/aws/public-cloud/mesos-slaves.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ resource "template_file" "slave_cloud_init" {
depends_on = ["template_file.etcd_discovery_url"]
vars {
etcd_discovery_url = "${file(var.etcd_discovery_url_file)}"
size = "${var.masters + var.slaves}"
size = "${var.masters}"
region = "${var.region}"
}
}

Expand Down
10 changes: 5 additions & 5 deletions terraform/aws/public-cloud/slave-cloud-config.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ coreos:
After=var-lib-docker.mount
Requires=var-lib-docker.mount
etcd2:
# $public_ipv4 and $private_ipv4 are populated by the cloud provider
advertise-client-urls: http://$public_ipv4:2379
initial-advertise-peer-urls: http://$private_ipv4:2380
proxy: on
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
listen-peer-urls: http://$private_ipv4:2380,http://$private_ipv4:7001
# Discovery is populated by Terraform
discovery: ${etcd_discovery_url}
fleet:
metadata: "role=slave,region=${region}"
public-ip: "$public_ipv4"
etcd_servers: "http://localhost:2379"
locksmith:
endpoint: "http://localhost:2379"
units:
- name: etcd2.service
command: start
Expand Down
10 changes: 6 additions & 4 deletions terraform/digitalocean/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ module "do-keypair" {
resource "template_file" "etcd_discovery_url" {
template = "/dev/null"
provisioner "local-exec" {
command = "curl https://discovery.etcd.io/new?size=${var.masters + var.slaves} > ${var.etcd_discovery_url_file}"
command = "curl https://discovery.etcd.io/new?size=${var.masters} > ${var.etcd_discovery_url_file}"
}
# This will regenerate the discovery URL if the cluster size changes
vars {
size = "${var.masters + var.slaves}"
size = "${var.masters}"
}
}

Expand All @@ -37,7 +37,8 @@ resource "template_file" "master_cloud_init" {
depends_on = ["template_file.etcd_discovery_url"]
vars {
etcd_discovery_url = "${file(var.etcd_discovery_url_file)}"
size = "${var.masters + var.slaves}"
size = "${var.masters}"
region = "${var.region}"
}
}

Expand All @@ -46,7 +47,8 @@ resource "template_file" "slave_cloud_init" {
depends_on = ["template_file.etcd_discovery_url"]
vars {
etcd_discovery_url = "${file(var.etcd_discovery_url_file)}"
size = "${var.masters + var.slaves}"
size = "${var.masters}"
region = "${var.region}"
}
}

Expand Down
7 changes: 2 additions & 5 deletions terraform/digitalocean/master-cloud-config.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

coreos:
etcd2:
# $private_ipv4 is populated by the cloud provider
# we don't have a $public_ipv4 in the private VPC
advertise-client-urls: http://$private_ipv4:2379,http://$private_ipv4:4001
initial-advertise-peer-urls: http://$private_ipv4:2380
# listen on both the official ports and the legacy ports
# legacy ports can be omitted if your application doesn't depend on them
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
listen-peer-urls: http://$private_ipv4:2380,http://$private_ipv4:7001
# Discovery is populated by Terraform
discovery: ${etcd_discovery_url}
fleet:
metadata: "role=master,region=${region}"
units:
- name: etcd2.service
command: start
Expand Down
14 changes: 6 additions & 8 deletions terraform/digitalocean/slave-cloud-config.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

coreos:
etcd2:
# $private_ipv4 is populated by the cloud provider
# we don't have a $public_ipv4 in the private VPC
advertise-client-urls: http://$private_ipv4:2379,http://$private_ipv4:4001
initial-advertise-peer-urls: http://$private_ipv4:2380
# listen on both the official ports and the legacy ports
# legacy ports can be omitted if your application doesn't depend on them
proxy: on
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
listen-peer-urls: http://$private_ipv4:2380,http://$private_ipv4:7001
# Discovery is populated by Terraform
discovery: ${etcd_discovery_url}
fleet:
metadata: "role=slave,region=${region}"
etcd_servers: "http://localhost:2379"
locksmith:
endpoint: "http://localhost:2379"
units:
- name: etcd2.service
command: start
Expand Down

0 comments on commit 95231ef

Please sign in to comment.