vagrant: add ability to use drives in the VMs
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 <seb@redhat.com>pull/2153/head
parent
a980731bed
commit
f8d6b84cb6
|
@ -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"
|
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 = {
|
SUPPORTED_OS = {
|
||||||
"coreos-stable" => {box: "coreos-stable", bootstrap_os: "coreos", user: "core", box_url: COREOS_URL_TEMPLATE % ["stable"]},
|
"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"]},
|
"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)
|
$kube_master_instances = $num_instances == 1 ? $num_instances : ($num_instances - 1)
|
||||||
# All nodes are kube nodes
|
# All nodes are kube nodes
|
||||||
$kube_node_instances = $num_instances
|
$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"
|
$local_release_dir = "/vagrant/temp"
|
||||||
|
|
||||||
host_vars = {}
|
host_vars = {}
|
||||||
|
@ -132,6 +140,18 @@ Vagrant.configure("2") do |config|
|
||||||
# Disable swap for each vm
|
# Disable swap for each vm
|
||||||
config.vm.provision "shell", inline: "swapoff -a"
|
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,
|
# Only execute once the Ansible provisioner,
|
||||||
# when all the machines are up and ready.
|
# when all the machines are up and ready.
|
||||||
if i == $num_instances
|
if i == $num_instances
|
||||||
|
|
Loading…
Reference in New Issue