From 0d01b78a4b059886f6052519da97efbbfc018d1f Mon Sep 17 00:00:00 2001
From: Pawel Wieczorek
Date: Mon, 9 Dec 2019 16:20:45 +0100
Subject: Deploy minimal ONAP
This patch prepares operator's environment for ONAP deployment (by
exporting environmental variables for use in helm override file). It
also fixes post-setup message regarding additional provisioning steps.
Issue-ID: ONAPARC-537
Change-Id: I18815578ddc46a2d5ef31d6cf44b42f9a5d3950d
Signed-off-by: Pawel Wieczorek
---
bootstrap/vagrant-minimal-onap/Vagrantfile | 27 ++++++++++++++++++++++++++-
bootstrap/vagrant-minimal-onap/config/dot_env | 5 +++++
2 files changed, 31 insertions(+), 1 deletion(-)
create mode 100644 bootstrap/vagrant-minimal-onap/config/dot_env
diff --git a/bootstrap/vagrant-minimal-onap/Vagrantfile b/bootstrap/vagrant-minimal-onap/Vagrantfile
index df9ddad9c..cbdb7ac7e 100644
--- a/bootstrap/vagrant-minimal-onap/Vagrantfile
+++ b/bootstrap/vagrant-minimal-onap/Vagrantfile
@@ -9,6 +9,7 @@ synced_folder_main = "/vagrant"
synced_folder_config = "#{synced_folder_main}/config"
synced_folder_tools_config = "#{synced_folder_main}/tools/config"
os_config = "#{synced_folder_config}/local.conf"
+os_env = "#{synced_folder_config}/dot_env"
cluster_yml = "cluster.yml"
apt_prefs_dir = "/etc/apt/apt.conf.d"
apt_prefs = "95silent-approval"
@@ -28,7 +29,7 @@ worker = { name: 'worker', hostname: 'worker', ip: '172.17.4.101', cpus: vm_cpus
cluster = [] << control << worker
all = cluster.dup << operation << devstack
-operation_post_msg = "Run: \"vagrant provision #{operation[:name]} --provision-with=rke_up,setup_kubectl\" to complete cluster creation"
+operation_post_msg = "Run: \"vagrant provision #{operation[:name]} --provision-with=rke_up,setup_kubectl,setup_helm_cluster,setup_helm_repo,deploy_onap\" to complete ONAP deployment"
$replace_dns = <<-SCRIPT
HOST_IP="$1"
@@ -137,6 +138,25 @@ $setup_helm_repo = <<-SCRIPT
make -C ${HOME}/oom/kubernetes onap
SCRIPT
+$deploy_onap = <<-SCRIPT
+ ENV="$1"
+ export $(cat "$ENV" | xargs)
+
+ encrypt () {
+ KEY="${HOME}/oom/kubernetes/so/resources/config/mso/encryption.key"
+ echo -n "$1" \
+ | openssl aes-128-ecb -e -K `cat "$KEY"` -nosalt \
+ | xxd -c 256 -p
+ }
+
+ export OPENSTACK_ENCRYPTED_PASSWORD="$(encrypt $OPENSTACK_PASSWORD)"
+
+ export KUBECONFIG="${HOME}/.kube/config.onap"
+
+ OVERRIDE="${HOME}/oom/kubernetes/onap/resources/environments/minimal-onap.yaml"
+ helm deploy minimal local/onap --namespace onap -f "$OVERRIDE" --verbose --timeout 900
+SCRIPT
+
Vagrant.configure('2') do |config|
all.each do |machine|
config.vm.define machine[:name] do |config|
@@ -229,6 +249,11 @@ Vagrant.configure('2') do |config|
config.vm.provision "install_make", type: :shell, inline: $install_make
config.vm.provision "setup_helm_cluster", type: :shell, run: "never", privileged: false, inline: $setup_helm_cluster
config.vm.provision "setup_helm_repo", type: :shell, run: "never", privileged: false, inline: $setup_helm_repo
+ config.vm.provision "deploy_onap", type: :shell, run: "never" do |s|
+ s.privileged = false
+ s.inline = $deploy_onap
+ s.args = os_env
+ end
end
end
end
diff --git a/bootstrap/vagrant-minimal-onap/config/dot_env b/bootstrap/vagrant-minimal-onap/config/dot_env
new file mode 100644
index 000000000..4e87c2a20
--- /dev/null
+++ b/bootstrap/vagrant-minimal-onap/config/dot_env
@@ -0,0 +1,5 @@
+OPENSTACK_USER_NAME='demo'
+OPENSTACK_REGION='RegionOne'
+OPENSTACK_KEYSTONE_URL='http://172.17.4.200/identity'
+OPENSTACK_TENANT_NAME='demo'
+OPENSTACK_PASSWORD='default123456!'
--
cgit 1.2.3-korg