From a980731bed6986ac00ed6815cc1b369eed6b856d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 11 Jan 2018 19:09:37 +0100 Subject: [PATCH 1/4] vagrant: remove trailing line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Han --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 40109f9b3..800a6d895 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -122,7 +122,7 @@ Vagrant.configure("2") do |config| } config.vm.network :private_network, ip: ip - + # workaround for Vagrant 1.9.1 and centos vm # https://github.com/hashicorp/vagrant/issues/8096 if Vagrant::VERSION == "1.9.1" && $os == "centos" From f8d6b84cb678fc87b0587a0743ba7ebad6065450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 11 Jan 2018 19:28:33 +0100 Subject: [PATCH 2/4] vagrant: add ability to use drives in the VMs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When testing deployments of SDS, it is quite useful to get a Kubernetes env with nodes having dedicated drives. You can now enable this by setting: kube_node_instances_with_disks: true Also you can chose the amount of drives per machine and their respective size: * kube_node_instances_with_disks_number: 10 * kube_node_instances_with_disks_size: "20G" Signed-off-by: Sébastien Han --- Vagrantfile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index 800a6d895..f89a874e8 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -9,6 +9,9 @@ CONFIG = File.join(File.dirname(__FILE__), "vagrant/config.rb") COREOS_URL_TEMPLATE = "https://storage.googleapis.com/%s.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json" +# Uniq disk UUID for libvirt +DISK_UUID = Time.now.utc.to_i + SUPPORTED_OS = { "coreos-stable" => {box: "coreos-stable", bootstrap_os: "coreos", user: "core", box_url: COREOS_URL_TEMPLATE % ["stable"]}, "coreos-alpha" => {box: "coreos-alpha", bootstrap_os: "coreos", user: "core", box_url: COREOS_URL_TEMPLATE % ["alpha"]}, @@ -34,6 +37,11 @@ $etcd_instances = $num_instances $kube_master_instances = $num_instances == 1 ? $num_instances : ($num_instances - 1) # All nodes are kube nodes $kube_node_instances = $num_instances +# The following only works when using the libvirt provider +$kube_node_instances_with_disks = false +$kube_node_instances_with_disks_size = "20G" +$kube_node_instances_with_disks_number = 2 + $local_release_dir = "/vagrant/temp" host_vars = {} @@ -132,6 +140,18 @@ Vagrant.configure("2") do |config| # Disable swap for each vm config.vm.provision "shell", inline: "swapoff -a" + if $kube_node_instances_with_disks + # Libvirt + driverletters = ('a'..'z').to_a + config.vm.provider :libvirt do |lv| + # always make /dev/sd{a/b/c} so that CI can ensure that + # virtualbox and libvirt will have the same devices to use for OSDs + (1..$kube_node_instances_with_disks_number).each do |d| + lv.storage :file, :device => "hd#{driverletters[d]}", :path => "disk-#{i}-#{d}-#{DISK_UUID}.disk", :size => $kube_node_instances_with_disks_size, :bus => "ide" + end + end + end + # Only execute once the Ansible provisioner, # when all the machines are up and ready. if i == $num_instances From 0684df804d115b11c9ffbe0aee0b0b6631429b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 11 Jan 2018 19:29:01 +0100 Subject: [PATCH 3/4] vagrant: libvirt add vm_memory support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Han --- Vagrantfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index f89a874e8..e9ea5fdaa 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -120,6 +120,10 @@ Vagrant.configure("2") do |config| vb.cpus = $vm_cpus end + config.vm.provider :libvirt do |lv| + lv.memory = $vm_memory + end + ip = "#{$subnet}.#{i+100}" host_vars[vm_name] = { "ip": ip, From dfcd60a9e2154bcb48e54321b58a909e19f5f802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Fri, 12 Jan 2018 17:43:41 +0100 Subject: [PATCH 4/4] vagrant: use "centos/7" box to support libvirt provider MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "centos/7" box is the official centos box and supports all the major providers: virtualbox Externally hosted (cloud.centos.org) vmware_desktop Externally hosted (cloud.centos.org) libvirt Externally hosted (cloud.centos.org) hyperv Externally hosted (cloud.centos.org) Where bento/centos-7.3 only supports: parallels Hosted by Vagrant Cloud (570 MB) virtualbox Hosted by Vagrant Cloud (525 MB) vmware_desktop Hosted by Vagrant Cloud (608 MB) Signed-off-by: Sébastien Han --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index e9ea5fdaa..aa20b6e13 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -17,7 +17,7 @@ SUPPORTED_OS = { "coreos-alpha" => {box: "coreos-alpha", bootstrap_os: "coreos", user: "core", box_url: COREOS_URL_TEMPLATE % ["alpha"]}, "coreos-beta" => {box: "coreos-beta", bootstrap_os: "coreos", user: "core", box_url: COREOS_URL_TEMPLATE % ["beta"]}, "ubuntu" => {box: "bento/ubuntu-16.04", bootstrap_os: "ubuntu", user: "vagrant"}, - "centos" => {box: "bento/centos-7.3", bootstrap_os: "centos", user: "vagrant"}, + "centos" => {box: "centos/7", bootstrap_os: "centos", user: "vagrant"}, } # Defaults for config options defined in CONFIG