Skip to content

Commit

Permalink
vagrant: Allow running several dev VMs concurrently
Browse files Browse the repository at this point in the history
This commit solves the conflict on the forwarded port of the dev VM to
allow running several instances concurrently.

Signed-off-by: Paul Chaignon <paul@cilium.io>
  • Loading branch information
pchaigno committed Mar 2, 2020
1 parent 39729f3 commit ac095a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Vagrantfile
Expand Up @@ -132,7 +132,7 @@ Vagrant.configure(2) do |config|
master_vm_name = "#{$vm_base_name}1#{$build_id_name}"
config.vm.define master_vm_name, primary: true do |cm|
node_ip = "#{$master_ip}"
cm.vm.network "forwarded_port", guest: 6443, host: 7443
cm.vm.network "forwarded_port", guest: 6443, host: 7443, auto_correct: true
cm.vm.network "private_network", ip: "#{$master_ip}",
virtualbox__intnet: "cilium-test-#{$build_id}",
:libvirt__guest_ipv6 => "yes",
Expand Down
3 changes: 2 additions & 1 deletion contrib/vagrant/start.sh
Expand Up @@ -602,7 +602,8 @@ elif [ -n "${PROVISION}" ]; then
else
vagrant up
if [ "$?" -eq "0" -a -n "${K8S}" ]; then
vagrant ssh k8s1 -- cat /home/vagrant/.kube/config | sed 's;server:.*:6443;server: https://k8s1:7443;g' > vagrant.kubeconfig
host_port=$(vagrant port --guest 6443)
vagrant ssh k8s1 -- cat /home/vagrant/.kube/config | sed "s;server:.*:6443;server: https://k8s1:$host_port;g" > vagrant.kubeconfig
echo "Add '127.0.0.1 k8s1' to your /etc/hosts to use vagrant.kubeconfig file for kubectl"
fi
fi
Expand Down

0 comments on commit ac095a6

Please sign in to comment.