bug-fix: fix timeout sshing to get k8s config
[bottlenecks.git] / utils / k8s_setup / k8s_config_pre.sh
index f41ba78..f57add7 100644 (file)
@@ -7,7 +7,7 @@
 # which accompanies this distribution, and is available at
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
-K8S_CONFIG="/tmp/k8s_conig"
+K8S_CONFIG="/tmp/k8s_config"
 
 usage="Script to prepare kubenetes test configurations.
 
@@ -59,8 +59,22 @@ while [[ $# > 0 ]]
      shift
 done
 
-if [[  ${INSTALLER_TYPE} == 'compass' ]]; then
-    sshpass -p root scp root@192.16.1.222:~/.kube/config ${K8S_CONFIG}
+if [[ ${INSTALLER_TYPE} == 'compass' ]]; then
+    sshpass -p root scp -o StrictHostKeyChecking=no root@10.1.0.50:~/.kube/config ${K8S_CONFIG}
 else
     echo "BOTTLENECKS EROOR: unrecognized installer"
 fi
+
+if [[ -f ${K8S_CONFIG} ]]; then
+    if [[ -d ~/.kube ]]; then
+        cp ${K8S_CONFIG} ~/.kube/config
+        echo "BOTTLENECKS INFO: copying k8s config to ~./kube"
+    else
+        mkdir ~/.kube
+        cp ${K8S_CONFIG} ~/.kube/config
+        echo "BOTTLENECKS INFO: copying k8s config to ~./kube"
+    fi
+else
+    echo "BOTTLENECKS ERROR: k8s config file does no exit (${K8S_CONFIG})"
+    exit 1
+fi