4 LIBDIR="$(dirname "$(dirname "$PWD")")"
6 source $LIBDIR/env/lib/common.sh
8 function get_kud_repo {
9 if [ -d $DOWNLOAD_PATH/multicloud-k8s ]; then
10 rm -rf $DOWNLOAD_PATH/multicloud-k8s
13 mkdir -p $DOWNLOAD_PATH
15 git clone https://github.com/onap/multicloud-k8s.git
19 function set_ssh_key {
20 if ! [ -f ~/.ssh/id_rsa ]; then
21 echo "Generating rsa key for this host"
22 ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa <&-
25 if ! grep -qF "$(ssh-keygen -y -f ~/.ssh/id_rsa)" ~/.ssh/authorized_keys; then
26 ssh-keygen -y -f ~/.ssh/id_rsa >> ~/.ssh/authorized_keys
29 chmod og-wx ~/.ssh/authorized_keys
33 pushd $DOWNLOAD_PATH/multicloud-k8s/kud/hosting_providers/vagrant/inventory
34 HOST_IP=${HOST_IP:-$(hostname -I | cut -d ' ' -f 1)}
35 if [ "$1" == "virlet" ] ; then
38 $HOSTNAME ansible_ssh_host=${HOST_IP} ansible_ssh_port=22
52 [k8s-cluster:children]
59 $HOSTNAME ansible_ssh_host=${HOST_IP} ansible_ssh_port=22
70 [k8s-cluster:children]
78 function kud_install {
79 pushd $DOWNLOAD_PATH/multicloud-k8s/kud/hosting_providers/vagrant/
80 ./installer.sh | tee kud_minial_deploy.log
85 APISERVER=$(kubectl config view --minify -o \
86 jsonpath='{.clusters[0].cluster.server}')
87 TOKEN=$(kubectl get secret \
88 $(kubectl get serviceaccount default -o \
89 jsonpath='{.secrets[0].name}') -o jsonpath='{.data.token}' | \
91 call_api $APISERVER/api --header "Authorization: Bearer $TOKEN" --insecure