Add kud_bm_verifier for CI tag
[icn.git] / deploy / kud / kud_bm_launch.sh
index 86d4aa3..2d0aea6 100755 (executable)
@@ -1,4 +1,6 @@
 #!/bin/bash
+set +x
+
 LIBDIR="$(dirname "$(dirname "$PWD")")"
 
 source $LIBDIR/env/lib/common.sh
@@ -10,7 +12,11 @@ function get_kud_repo {
 
     mkdir -p $DOWNLOAD_PATH
     pushd $DOWNLOAD_PATH
-    git clone https://github.com/onap/multicloud-k8s.git
+    if [ "$1" == "v1" ] ; then
+        git clone --branch v1.0-icn https://github.com/akraino-icn/multicloud-k8s.git
+    else
+        git clone https://github.com/onap/multicloud-k8s.git
+    fi
     popd
 }
 
@@ -30,6 +36,25 @@ function set_ssh_key {
 function set_bm_kud {
     pushd $DOWNLOAD_PATH/multicloud-k8s/kud/hosting_providers/vagrant/inventory
     HOST_IP=${HOST_IP:-$(hostname -I | cut -d ' ' -f 1)}
+    if [ "$1" == "minimal" ] ; then
+    cat <<EOL > hosts.ini
+[all]
+$HOSTNAME ansible_ssh_host=${HOST_IP} ansible_ssh_port=22
+
+[kube-master]
+$HOSTNAME
+
+[kube-node]
+$HOSTNAME
+
+[etcd]
+$HOSTNAME
+
+[k8s-cluster:children]
+kube-node
+kube-master
+EOL
+    else
     cat <<EOL > hosts.ini
 [all]
 $HOSTNAME ansible_ssh_host=${HOST_IP} ansible_ssh_port=22
@@ -43,6 +68,12 @@ $HOSTNAME
 [etcd]
 $HOSTNAME
 
+[ovn-central]
+$HOSTNAME
+
+[ovn-controller]
+$HOSTNAME
+
 [virtlet]
 $HOSTNAME
 
@@ -50,15 +81,38 @@ $HOSTNAME
 kube-node
 kube-master
 EOL
+    fi
     popd
 }
 
 function kud_install {
     pushd $DOWNLOAD_PATH/multicloud-k8s/kud/hosting_providers/vagrant/
-    ./installer.sh | tee kud_minial_deploy.log
+    if [ "$1" == "all" -o "$1" == "vm" ]; then
+        sed -i -e 's/testing_enabled=${KUD_ENABLE_TESTS:-false}/testing_enabled=${KUD_ENABLE_TESTS:-true}/g' installer.sh
+    fi
+    if [ "$1" == "vm" ]; then
+        sed -i -e 's/^kube_pods_subnet.*/kube_pods_subnet: 172.21.64.0\/18/g' inventory/group_vars/k8s-cluster.yml
+    fi
+    ./installer.sh | tee kud_deploy.log
+
+    if [ "$1" == "bm" ]; then
+        for addon in ${KUD_ADDONS:-multus ovn4nfv nfd sriov qat cmk optane}; do
+            pushd $DOWNLOAD_PATH/multicloud-k8s/kud/tests/
+                bash ${addon}.sh
+            popd
+        done
+    fi
+    popd
+}
+
+function kud_reset {
+    pushd $DOWNLOAD_PATH/multicloud-k8s/kud/hosting_providers/vagrant/
+    ansible-playbook -i inventory/hosts.ini /opt/kubespray-2.10.4/reset.yml \
+        --become --become-user=root -e reset_confirmation=yes
     popd
 }
 
+
 function verifier {
     APISERVER=$(kubectl config view --minify -o \
                     jsonpath='{.clusters[0].cluster.server}')
@@ -69,11 +123,15 @@ function verifier {
   call_api $APISERVER/api --header "Authorization: Bearer $TOKEN" --insecure
 }
 
+if [ "$1" == "reset" ] ; then
+    kud_reset
+    exit 0
+fi
 
-get_kud_repo
+get_kud_repo $2
 set_ssh_key
-set_bm_kud
-kud_install
+set_bm_kud $1
+kud_install $1
 verifier
 
 exit 0