Skip to content

Commit

Permalink
Use unique disks for caches and unique networks based on target
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Mohr <[email protected]>
  • Loading branch information
rmohr committed Dec 6, 2017
1 parent 7c405d9 commit 151c32d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 23 deletions.
15 changes: 6 additions & 9 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ $vagrant_pool = (ENV['VAGRANT_POOL'] unless
(ENV['VAGRANT_POOL'].nil? or ENV['VAGRANT_POOL'].empty?))
# Used for matrix builds to similar setups on the same node without vagrant
# machine name clashes.
$libvirt_prefix = (ENV['TARGET'] unless
(ENV['TARGET'].nil? or ENV['TARGET'].empty?))
$libvirt_prefix = ENV['TARGET'] || "kubevirt"

$config = Hash[*File.read('hack/config-default.sh').split(/=|\n/)]
if File.file?('hack/config-local.sh') then
Expand Down Expand Up @@ -46,9 +45,7 @@ Vagrant.configure(2) do |config|
if $vagrant_pool then
domain.storage_pool_name = $vagrant_pool
end
if $libvirt_prefix then
domain.default_prefix = $libvirt_prefix
end
domain.default_prefix = $libvirt_prefix
end

if $use_nfs then
Expand Down Expand Up @@ -76,11 +73,11 @@ Vagrant.configure(2) do |config|

config.vm.define "master" do |master|
master.vm.hostname = "master"
master.vm.network "private_network", ip: "#{$master_ip}"
master.vm.network "private_network", ip: "#{$master_ip}", libvirt__network_name: $libvirt_prefix + "0"
master.vm.provider :libvirt do |domain|
domain.memory = 3000
if $cache_docker then
domain.storage :file, :size => '10G', :path => 'kubevirt_master_docker.img', :allow_existing => true
domain.storage :file, :size => '10G', :path => $libvirt_prefix.to_s + '_master_docker.img', :allow_existing => true
end
end

Expand All @@ -102,11 +99,11 @@ Vagrant.configure(2) do |config|
(0..($nodes-1)).each do |suffix|
config.vm.define "node" + suffix.to_s do |node|
node.vm.hostname = "node" + suffix.to_s
node.vm.network "private_network", ip: $master_ip[0..-2] + ($master_ip[-1].to_i + 1 + suffix).to_s
node.vm.network "private_network", ip: $master_ip[0..-2] + ($master_ip[-1].to_i + 1 + suffix).to_s, libvirt__network_name: $libvirt_prefix + "0"
node.vm.provider :libvirt do |domain|
domain.memory = 2048
if $cache_docker then
domain.storage :file, :size => '10G', :path => 'kubevirt_node_docker' + suffix.to_s + '.img', :allow_existing => true
domain.storage :file, :size => '10G', :path => $libvirt_prefix.to_s + '_node_docker' + suffix.to_s + '.img', :allow_existing => true
end
end

Expand Down
16 changes: 4 additions & 12 deletions automation/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ kubectl() { cluster/kubectl.sh --core "$@"; }

if [ "$TARGET" = "vagrant-dev" ]; then
cat > hack/config-local.sh <<EOF
master_ip=192.168.1.2
master_ip=192.168.1.2
EOF
elif [ "$TARGET" = "vagrant-release" ]; then
cat > hack/config-local.sh <<EOF
master_ip=192.168.2.2
master_ip=192.168.2.2
EOF
fi


VAGRANT_PREFIX=${VARIABLE:-kubevirt}

# Install GO
eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=stable bash)"
Expand All @@ -61,17 +61,9 @@ trap '{ vagrant halt; }' EXIT

set +e

# TODO handle complete workspace removal on CI
vagrant up --provider=libvirt
if [ $? -ne 0 ]; then
# After a workspace cleanup we loose our .vagrant file, this means that we have to clean up libvirt
vagrant destroy
virsh destroy kubevirt_master
virsh undefine kubevirt_master
virsh destroy kubevirt_node0
virsh undefine kubevirt_node0
virsh net-destroy vagrant0
virsh net-undefine vagrant0
# Remove now stale images
vagrant destroy
set -e
vagrant up --provider=libvirt
Expand Down
4 changes: 2 additions & 2 deletions docs/dev-env-local.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ we need the IP address of the host.

```bash
cat > hack/config-local.sh <<EOF
master_ip=192.168.122.13
docker_tag=latest
master_ip=192.168.122.13
docker_tag=latest
EOF
make manifests docker
```
Expand Down

0 comments on commit 151c32d

Please sign in to comment.