From 45dbe6d542a13d8d0f04ab19bea57729d9c72ed7 Mon Sep 17 00:00:00 2001 From: John Dewey Date: Thu, 16 Feb 2017 12:46:04 -0800 Subject: [PATCH] Better control instance sizing * Git ignore the user controlled config.rb. * Ability to better control the number of instances running. --- .gitignore | 1 + Vagrantfile | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index fc2bd5b1f..074dd431d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ temp **/*.sw[pon] /ssh-bastion.conf **/*.sw[pon] +vagrant/ diff --git a/Vagrantfile b/Vagrantfile index 76db41a8b..a068eeabf 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -17,6 +17,12 @@ $shared_folders = {} $forwarded_ports = {} $subnet = "172.17.8" $box = "bento/ubuntu-16.04" +# The first three nodes are etcd servers +$etcd_instances = $num_instances +# The first two nodes are masters +$kube_master_instances = $num_instances == 1 ? $num_instances : ($num_instances - 1) +# All nodes are kube nodes +$kube_node_instances = $num_instances host_vars = {} @@ -112,12 +118,9 @@ Vagrant.configure("2") do |config| ansible.host_vars = host_vars #ansible.tags = ['download'] ansible.groups = { - # The first three nodes should be etcd servers - "etcd" => ["#{$instance_name_prefix}-0[1:3]"], - # The first two nodes should be masters - "kube-master" => ["#{$instance_name_prefix}-0[1:2]"], - # all nodes should be kube nodes - "kube-node" => ["#{$instance_name_prefix}-0[1:#{$num_instances}]"], + "etcd" => ["#{$instance_name_prefix}-0[1:#{$etcd_instances}]"], + "kube-master" => ["#{$instance_name_prefix}-0[1:#{$kube_master_instances}]"], + "kube-node" => ["#{$instance_name_prefix}-0[1:#{$kube_node_instances}]"], "k8s-cluster:children" => ["kube-master", "kube-node"], } end