SHELL:=/bin/bash
+ENV:=$(CURDIR)/env
BMDIR:=$(CURDIR)/env/metal3
METAL3DIR:=$(CURDIR)/deploy/metal3/scripts
BPA_OPERATOR:=$(CURDIR)/cmd/bpa-operator/
bm_all: bm_preinstall bm_install
-kud_download:
- pushd $(KUD_PATH) && ./kud_launch.sh && popd
+kud_bm_deploy:
+ pushd $(KUD_PATH) && ./kud_bm_launch.sh && popd
bpa_op_install:
pushd $(BPA_OPERATOR) && make docker && make deploy && popd
bashate:
bashate -i E006 `find . -name *.sh`
-ci_dummy_test:
- $(info ************ TESTING ICN CD LOGS ************)
+prerequisite:
+ pushd $(ENV) && ./cd_package_installer.sh && popd
-verify_all: ci_dummy_test
-
-verifer: verify_all
+verify_all: prerequisite \
+ kud_bm_deploy
+verifier: verify_all
.PHONY: all bm_preinstall bm_install bashate
--- /dev/null
+#!/bin/bash
+LIBDIR="$(dirname "$(dirname "$PWD")")"
+
+source $LIBDIR/env/lib/common.sh
+
+function get_kud_repo {
+ if [ -d $DOWNLOAD_PATH/multicloud-k8s ]; then
+ rm -rf $DOWNLOAD_PATH/multicloud-k8s
+ fi
+
+ mkdir -p $DOWNLOAD_PATH
+ pushd $DOWNLOAD_PATH
+ git clone https://github.com/onap/multicloud-k8s.git
+ popd
+}
+
+function set_ssh_key {
+ if ! [ -f ~/.ssh/id_rsa ]; then
+ echo "Generating rsa key for this host"
+ ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa <&-
+ fi
+
+ if ! grep -qF "$(ssh-keygen -y -f ~/.ssh/id_rsa)" ~/.ssh/authorized_keys; then
+ ssh-keygen -y -f ~/.ssh/id_rsa >> ~/.ssh/authorized_keys
+ fi
+
+ chmod og-wx ~/.ssh/authorized_keys
+}
+
+function set_bm_kud {
+ pushd $DOWNLOAD_PATH/multicloud-k8s/kud/hosting_providers/vagrant/inventory
+ HOST_IP=${HOST_IP:-$(hostname -I | cut -d ' ' -f 1)}
+ cat <<EOL > hosts.ini
+[all]
+$HOSTNAME ansible_ssh_host=${HOST_IP} ansible_ssh_port=22
+
+[kube-master]
+$HOSTNAME
+
+[kube-node]
+$HOSTNAME
+
+[etcd]
+$HOSTNAME
+
+[virtlet]
+$HOSTNAME
+
+[k8s-cluster:children]
+kube-node
+kube-master
+EOL
+ popd
+}
+
+function kud_install {
+ pushd $DOWNLOAD_PATH/multicloud-k8s/kud/hosting_providers/vagrant/
+ ./installer.sh | tee kud_minial_deploy.log
+ popd
+}
+
+function verifier {
+ APISERVER=$(kubectl config view --minify -o \
+ jsonpath='{.clusters[0].cluster.server}')
+ TOKEN=$(kubectl get secret \
+ $(kubectl get serviceaccount default -o \
+ jsonpath='{.secrets[0].name}') -o jsonpath='{.data.token}' | \
+ base64 --decode )
+ call_api $APISERVER/api --header "Authorization: Bearer $TOKEN" --insecure
+}
+
+
+get_kud_repo
+set_ssh_key
+set_bm_kud
+kud_install
+verifier
+
+exit 0
--- /dev/null
+#!/usr/bin/env bash
+set -ex
+
+if [[ $EUID -ne 0 ]]; then
+ echo "This script must be run as root"
+ exit 1
+fi
+
+function install_essential_packages {
+ export DEBIAN_FRONTEND=noninteractive
+ apt-get update
+ apt-get -y install \
+ crudini \
+ curl \
+ dnsmasq \
+ figlet \
+ nmap \
+ patch \
+ psmisc \
+ python-pip \
+ python-requests \
+ python-setuptools \
+ vim \
+ wget \
+ git \
+ software-properties-common
+
+ add-apt-repository -y ppa:longsleep/golang-backports
+ apt-get update
+ apt-get install -y golang-go
+}
+
+install_essential_packages
UBUNTU_BIONIC=${UBUNTU_BIONIC:-Ubuntu 18.04.2 LTS}
#offline mode variable
-DOWNLOAD_PATH=${DOWNLOAD_PATH:-/opt/icn/}
+DOWNLOAD_PATH=${DOWNLOAD_PATH:-/opt/icn}
LOCAL_APT_REPO=${LOCAL_APT_REPO:-$DOWNLOAD_PATH/apt}
PIP_CACHE_DIR=${PIP_CACHE_DIR:-$DOWNLOAD_PATH/pip-cache-dir}
BUILD_DIR=${BUILD_DIR:-$DOWNLOAD_PATH/build-dir}
COMPUTE_NODE_FQDN=${COMPUTE_NODE_FQDN:-"node01.akraino.org"}
#COMPUTE_NODE_HOSTNAME=${COMPUTE_NODE_HOSTNAME:-"node01"}
COMPUTE_NODE_PASSWORD=${COMPUTE_NODE_PASSWORD:-"mypasswd"}
+
+#refered from onap
+function call_api {
+ #Runs curl with passed flags and provides
+ #additional error handling and debug information
+
+ #Function outputs server response body
+ #and performs validation of http_code
+
+ local status
+ local curl_response_file="$(mktemp -p /tmp)"
+ local curl_common_flags=(-s -w "%{http_code}" -o "${curl_response_file}")
+ local command=(curl "${curl_common_flags[@]}" "$@")
+
+ echo "[INFO] Running '${command[@]}'" >&2
+ if ! status="$("${command[@]}")"; then
+ echo "[ERROR] Internal curl error! '$status'" >&2
+ cat "${curl_response_file}"
+ rm "${curl_response_file}"
+ return 2
+ else
+ echo "[INFO] Server replied with status: ${status}" >&2
+ cat "${curl_response_file}"
+ rm "${curl_response_file}"
+ if [[ "${status:0:1}" =~ [45] ]]; then
+ return 1
+ else
+ return 0
+ fi
+ fi
+}