Better control instance sizing

* Git ignore the user controlled config.rb.
* Ability to better control the number of instances running.
This commit is contained in:
John Dewey 2017-02-16 12:46:04 -08:00
parent d92d955aeb
commit 45dbe6d542
No known key found for this signature in database
GPG key ID: 85CA6C7BD56CF2EB
2 changed files with 10 additions and 6 deletions

1
.gitignore vendored
View file

@ -13,3 +13,4 @@ temp
**/*.sw[pon] **/*.sw[pon]
/ssh-bastion.conf /ssh-bastion.conf
**/*.sw[pon] **/*.sw[pon]
vagrant/

15
Vagrantfile vendored
View file

@ -17,6 +17,12 @@ $shared_folders = {}
$forwarded_ports = {} $forwarded_ports = {}
$subnet = "172.17.8" $subnet = "172.17.8"
$box = "bento/ubuntu-16.04" $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 = {} host_vars = {}
@ -112,12 +118,9 @@ Vagrant.configure("2") do |config|
ansible.host_vars = host_vars ansible.host_vars = host_vars
#ansible.tags = ['download'] #ansible.tags = ['download']
ansible.groups = { ansible.groups = {
# The first three nodes should be etcd servers "etcd" => ["#{$instance_name_prefix}-0[1:#{$etcd_instances}]"],
"etcd" => ["#{$instance_name_prefix}-0[1:3]"], "kube-master" => ["#{$instance_name_prefix}-0[1:#{$kube_master_instances}]"],
# The first two nodes should be masters "kube-node" => ["#{$instance_name_prefix}-0[1:#{$kube_node_instances}]"],
"kube-master" => ["#{$instance_name_prefix}-0[1:2]"],
# all nodes should be kube nodes
"kube-node" => ["#{$instance_name_prefix}-0[1:#{$num_instances}]"],
"k8s-cluster:children" => ["kube-master", "kube-node"], "k8s-cluster:children" => ["kube-master", "kube-node"],
} }
end end