From a65cd1ca58eae2348ff50487cc1b5c6d05531fc3 Mon Sep 17 00:00:00 2001
From: Pawel Wieczorek
Date: Thu, 27 Jun 2019 17:49:21 +0200
Subject: k8s: Make Rancher CLI provisioner reusable
Having Rancher CLI proves itself useful on development machines as well.
Issue-ID: SECCOM-235
Change-Id: I0de3109e1236cf6dc9cbc825342593041dcfdf2c
Signed-off-by: Pawel Wieczorek
---
test/security/k8s/tools/get_ranchercli.sh | 13 +++++++++++++
test/security/k8s/vagrant/Vagrantfile | 10 +---------
2 files changed, 14 insertions(+), 9 deletions(-)
create mode 100755 test/security/k8s/tools/get_ranchercli.sh
(limited to 'test/security/k8s')
diff --git a/test/security/k8s/tools/get_ranchercli.sh b/test/security/k8s/tools/get_ranchercli.sh
new file mode 100755
index 000000000..d36a94edb
--- /dev/null
+++ b/test/security/k8s/tools/get_ranchercli.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+# Prerequistes
+wget https://releases.rancher.com/cli/v0.6.12/rancher-linux-amd64-v0.6.12.tar.gz
+tar xf rancher-linux-amd64-v0.6.12.tar.gz
+
+# Installation
+echo '# Privilege elevation needed to move Rancher CLI binary to /usr/local/bin'
+sudo mv rancher-v0.6.12/rancher /usr/local/bin/
+
+# Cleanup
+rmdir rancher-v0.6.12/
+rm rancher-linux-amd64-v0.6.12.tar.gz
diff --git a/test/security/k8s/vagrant/Vagrantfile b/test/security/k8s/vagrant/Vagrantfile
index c0cbb9889..b7848620a 100644
--- a/test/security/k8s/vagrant/Vagrantfile
+++ b/test/security/k8s/vagrant/Vagrantfile
@@ -9,14 +9,6 @@ cluster = [
{ name: 'worker', hostname: 'worker', ip: '172.17.0.101' }
]
-ranchercli = <<-SCRIPT
-wget https://releases.rancher.com/cli/v0.6.12/rancher-linux-amd64-v0.6.12.tar.gz
-tar xf rancher-linux-amd64-v0.6.12.tar.gz
-sudo mv rancher-v0.6.12/rancher /usr/local/bin/
-rmdir rancher-v0.6.12/
-rm rancher-linux-amd64-v0.6.12.tar.gz
-SCRIPT
-
Vagrant.configure('2') do |config|
cluster.each do |node|
config.vm.define node[:name] do |config|
@@ -39,7 +31,7 @@ Vagrant.configure('2') do |config|
if node[:name] == 'master'
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.provision :shell, path: "../tools/imported/openstack-rancher.sh"
- config.vm.provision :shell, inline: ranchercli
+ config.vm.provision :shell, path: "../tools/get_ranchercli.sh"
end
if node[:name] == 'worker'
--
cgit 1.2.3-korg