Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit 9ad5679

Browse files
author
Patrick Baxter
committed
hack/terraform-quickstart: support bringing up extra masters
1 parent 84a7111 commit 9ad5679

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

hack/terraform-quickstart/main.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ resource "aws_instance" "worker_node" {
2525
}
2626
}
2727

28+
resource "aws_instance" "master_node" {
29+
ami = "${data.aws_ami.coreos_ami.image_id}"
30+
instance_type = "m3.medium"
31+
key_name = "${var.ssh_key}"
32+
count = "${var.additional_masters}"
33+
34+
tags {
35+
Name = "${var.instance_tags}"
36+
}
37+
}
38+
2839
data "aws_ami" "coreos_ami" {
2940
most_recent = true
3041

hack/terraform-quickstart/outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ output "worker_ips" {
66
value = ["${aws_instance.worker_node.*.public_ip}"]
77
}
88

9+
output "master_ips" {
10+
value = ["${aws_instance.master_node.*.public_ip}"]
11+
}
12+
913
output "self_host_etcd" {
1014
value = "${var.self_host_etcd}"
1115
}

hack/terraform-quickstart/start-cluster.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set -euo pipefail
33

44
export BOOTSTRAP_IP=`terraform output bootstrap_node_ip`
55
export WORKER_IPS=`terraform output -json worker_ips | jq -r '.value[]'`
6+
export MASTER_IPS=`terraform output -json master_ips | jq -r '.value[]'`
67
export SELF_HOST_ETCD=`terraform output self_host_etcd`
78
export SSH_OPTS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
89

@@ -11,5 +12,10 @@ cd ../quickstart
1112

1213
for IP in $WORKER_IPS
1314
do
14-
./init-worker.sh $IP cluster/auth/kubeconfig
15+
./init-node.sh $IP cluster/auth/kubeconfig
16+
done
17+
18+
for IP in $MASTER_IPS
19+
do
20+
TAG_MASTER=true ./init-node.sh $IP cluster/auth/kubeconfig
1521
done

hack/terraform-quickstart/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ variable "num_workers" {
2727
default = "1"
2828
}
2929

30+
variable "additional_masters" {
31+
description = "number of additional master nodes not including bootstrap node"
32+
type = "string"
33+
default = "0"
34+
}
35+
3036
variable "region" {
3137
description = "aws region"
3238
type = "string"

0 commit comments

Comments
 (0)