aboutsummaryrefslogtreecommitdiffstats
path: root/test/security/k8s/vagrant/dublin/Vagrantfile
diff options
context:
space:
mode:
authorPawel Wieczorek <p.wieczorek2@samsung.com>2019-07-19 19:10:07 +0200
committerPawel Wieczorek <p.wieczorek2@samsung.com>2019-07-21 13:17:00 +0200
commitb7f08110865e5e79cf018a6ab9d80f3e7dec20af (patch)
treed44a3d25612af2cbd9db945571595eed759a6178 /test/security/k8s/vagrant/dublin/Vagrantfile
parent961b6441342214281379cf880eacc835aea2bc9c (diff)
k8s: Add virtual environment for Dublin
Default cluster nodes customization scripts were extracted in the same manner as those for Casablanca release [1]. Constraints still apply. [1] SHA-1: ea8bc1a719a36c89e7eae42080b1835e5ef0c28d (Change-Id: I57f9f3caac0e8b391e9ed480f6bebba98e006882) Issue-ID: SECCOM-235 Change-Id: I54ada5fade3b984dedd1715f20579e3ce901faa3 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
Diffstat (limited to 'test/security/k8s/vagrant/dublin/Vagrantfile')
-rw-r--r--test/security/k8s/vagrant/dublin/Vagrantfile71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/security/k8s/vagrant/dublin/Vagrantfile b/test/security/k8s/vagrant/dublin/Vagrantfile
new file mode 100644
index 000000000..dc5580944
--- /dev/null
+++ b/test/security/k8s/vagrant/dublin/Vagrantfile
@@ -0,0 +1,71 @@
+# -*- mode: ruby -*-
+# -*- coding: utf-8 -*-
+
+host_ip = "192.168.121.1"
+operator_key = "~/.ssh/onap-key"
+
+vm_memory = 2 * 1024
+vm_cpus = 1
+vm_box = "generic/ubuntu1804"
+
+operation = { name: 'operator', hostname: 'operator', ip: '172.17.0.254' }
+cluster = [
+ { name: 'control', hostname: 'control', ip: '172.17.0.100' },
+ { name: 'worker', hostname: 'worker', ip: '172.17.0.101' }
+]
+
+all = cluster.dup << operation
+
+Vagrant.configure('2') do |config|
+ all.each do |machine|
+ config.vm.define machine[:name] do |config|
+ config.vm.box = vm_box
+ config.vm.hostname = machine[:hostname]
+
+ config.vm.provider :virtualbox do |v|
+ v.name = machine[:name]
+ v.memory = vm_memory
+ v.cpus = vm_cpus
+ end
+
+ config.vm.provider :libvirt do |v|
+ v.memory = vm_memory
+ v.cpus = vm_cpus
+ end
+
+ config.vm.network :private_network, ip: machine[:ip]
+ config.vm.provision :shell, inline: <<-SHELL
+ rm -f /etc/resolv.conf # drop its dynamic management by systemd-resolved
+ echo nameserver #{host_ip} | tee /etc/resolv.conf
+ SHELL
+
+ if machine[:name] == 'control'
+ config.vm.provision :shell, path: "../../tools/dublin/imported/openstack-k8s-controlnode.sh"
+ end
+
+ if machine[:name] == 'worker'
+ config.vm.provision :shell, path: "../../tools/dublin/imported/openstack-k8s-workernode.sh"
+ end
+
+ if machine[:name] == 'operator'
+ config.vm.provision :shell, path: "../../tools/dublin/get_rke.sh"
+
+ config.vm.provision :shell, inline: <<-SHELL
+ apt-get update
+ apt-get install sshpass
+ SHELL
+ config.vm.provision :shell, privileged: false, inline: <<-SHELL
+ ssh-keygen -q -b 4096 -t rsa -f #{operator_key} -N ""
+ SHELL
+
+ ips = ""
+ cluster.each { |node| ips << node[:ip] << " " }
+ config.vm.provision :shell, privileged: false, inline: <<-SHELL
+ for ip in #{ips}; do
+ sshpass -p vagrant ssh-copy-id -o StrictHostKeyChecking=no -i #{operator_key} "$ip"
+ done
+ SHELL
+ end
+ end
+ end
+end