Rework vagrant cluster set up.
* Have a single config file that mirrors other cluster providers * Warn users not to use 'vagrant up' directly * Allow 'extra' parameters to the docker daemon. Fixes #2685 * Renumbers things so that they are more sane. Master/minions are 10.245.1.x, container subnets are 10.246.x.1/24, portal is 10.247.0.0/16
This commit is contained in:
26
Vagrantfile
vendored
26
Vagrantfile
vendored
@@ -7,14 +7,22 @@ VAGRANTFILE_API_VERSION = "2"
|
||||
# Require a recent version of vagrant otherwise some have reported errors setting host names on boxes
|
||||
Vagrant.require_version ">= 1.6.2"
|
||||
|
||||
if ARGV.first == "up" && ENV['USING_KUBE_SCRIPTS'] != 'true'
|
||||
raise Vagrant::Errors::VagrantError.new, <<END
|
||||
Calling 'vagrant up' directly is not supported. Instead, please run the following:
|
||||
|
||||
export KUBERNETES_PROVIDER=vagrant
|
||||
./cluster/kube-up.sh
|
||||
END
|
||||
end
|
||||
|
||||
# The number of minions to provision
|
||||
$num_minion = (ENV['KUBERNETES_NUM_MINIONS'] || 3).to_i
|
||||
$num_minion = (ENV['NUM_MINIONS'] || 3).to_i
|
||||
|
||||
# ip configuration
|
||||
$master_ip = "10.245.1.2"
|
||||
$minion_ip_base = "10.245.2."
|
||||
$minion_ips = $num_minion.times.collect { |n| $minion_ip_base + "#{n+2}" }
|
||||
$minion_ips_str = $minion_ips.join(",")
|
||||
$master_ip = ENV['MASTER_IP']
|
||||
$minion_ip_base = ENV['MINION_IP_BASE'] || ""
|
||||
$minion_ips = $num_minion.times.collect { |n| $minion_ip_base + "#{n+3}" }
|
||||
|
||||
# Determine the OS platform to use
|
||||
$kube_os = ENV['KUBERNETES_OS'] || "fedora"
|
||||
@@ -64,9 +72,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
config.vm.define "master" do |config|
|
||||
customize_vm config
|
||||
|
||||
config.vm.provision "shell", inline: "/vagrant/cluster/vagrant/provision-master.sh #{$master_ip} #{$num_minion} #{$minion_ips_str}"
|
||||
config.vm.provision "shell", run: "always", path: "#{ENV['KUBE_TEMP']}/master-start.sh"
|
||||
config.vm.network "private_network", ip: "#{$master_ip}"
|
||||
config.vm.hostname = "kubernetes-master"
|
||||
config.vm.hostname = ENV['MASTER_NAME']
|
||||
end
|
||||
|
||||
# Kubernetes minion
|
||||
@@ -76,9 +84,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
|
||||
minion_index = n+1
|
||||
minion_ip = $minion_ips[n]
|
||||
minion.vm.provision "shell", inline: "/vagrant/cluster/vagrant/provision-minion.sh #{$master_ip} #{$num_minion} #{$minion_ips_str} #{minion_ip} #{minion_index}"
|
||||
minion.vm.provision "shell", run: "always", path: "#{ENV['KUBE_TEMP']}/minion-start-#{n}.sh"
|
||||
minion.vm.network "private_network", ip: "#{minion_ip}"
|
||||
minion.vm.hostname = "kubernetes-minion-#{minion_index}"
|
||||
minion.vm.hostname = "#{ENV['INSTANCE_PREFIX']}-minion-#{minion_index}"
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user