openstack-helm/tools/vagrant/Vagrantfile
Stacey Fletcher bf5c643ce1 Move dev directory contents and update VagrantFile
This PS moves the dev contents to the tools directory as well
as updates the VagrantFile to use the existing scripts
for installing kubeadm-aio and deploying helm charts.

Change-Id: I6768d1f96abe6b15f66931d543e9adcc0e82829b
2017-06-02 10:11:04 -05:00

95 lines
3.7 KiB
Ruby

# -*- mode: ruby -*-
# vi: set ft=ruby :
# NOTE: Variable overrides are in ./config.rb
require "yaml"
require "fileutils"
# Use a variable file for overrides:
CONFIG = File.expand_path("config.rb")
if File.exist?(CONFIG)
require CONFIG
end
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = $vm_image
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network "private_network", ip: "192.168.33.10"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "../", "/opt/openstack-helm"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = false
# Customize the amount of memory on the VM:
vb.memory = $ram
# Customize the number of vCPUs in the VM:
vb.cpus = $vcpu_cores
# Set the size of the VM's docker disk:
unless File.exist?('.vagrant/machines/default/openstack-helm-storage.vdi')
vb.customize ['createhd', '--filename', '.vagrant/machines/default/openstack-helm-storage', '--size', $docker_disk]
end
vb.customize ['storageattach', :id, '--storagectl', 'SCSI', '--port', 2, '--device', 0, '--type', 'hdd', '--medium', '.vagrant/machines/default/openstack-helm-storage.vdi']
# Set the size of the VM's PVC disk:
unless File.exist?('.vagrant/machines/default/openstack-helm-storage-kube-pvc.vdi')
vb.customize ['createhd', '--filename', '.vagrant/machines/default/openstack-helm-storage-kube-pvc', '--size', $pvc_disk]
end
vb.customize ['storageattach', :id, '--storagectl', 'SCSI', '--port', 3, '--device', 0, '--type', 'hdd', '--medium', '.vagrant/machines/default/openstack-helm-storage-kube-pvc.vdi']
end
# Enable provisioning with a shell script.
config.vm.provision "shell", inline: <<-SHELL
# Setup docker storage
mkfs.xfs /dev/disk/by-path/pci-0000\:00\:14.0-scsi-0\:0\:2\:0 -f -L docker-srg
mkdir -p /var/lib/docker
echo "LABEL=docker-srg /var/lib/docker xfs defaults 0 0" >> /etc/fstab
# Setup kubelet pvc storage
mkfs.xfs /dev/disk/by-path/pci-0000\:00\:14.0-scsi-0\:0\:3\:0 -f -L kube-srg
mkdir -p /var/lib/nfs-provisioner
echo "LABEL=kube-srg /var/lib/nfs-provisioner xfs defaults 0 0" >> /etc/fstab
# Mount Storage
mount -a
apt-get update
apt-get install -y git
SHELL
config.vm.provision "shell", privileged: false, inline: <<-SHELL
#Cloning repo
git clone https://git.openstack.org/openstack/openstack-helm
cd openstack-helm
export INTEGRATION='aio'
export INTEGRATION_TYPE='basic'
./tools/gate/setup_gate.sh
SHELL
end