VOL-3365 update creation of kubectl config file
Change-Id: I7d35f699c8a6f73bc77cc175c7b40adc5d4fb603
diff --git a/voltha b/voltha
index 65347e9..87512fd 100755
--- a/voltha
+++ b/voltha
@@ -1752,13 +1752,12 @@
echo "" | tee -a "$LOG"
echo -en "$BOLD"
if [ "$DEPLOY_K8S" == "yes" ]; then
- if [ "$HELM_MAJOR" -le 2 ]; then
- KUBECONFIG="$(kind get kubeconfig-path --name="voltha-$NAME")"; export KUBECONFIG
- else
- KUBECONFIG="$HOME/.kube/kind-config-voltha-$NAME"; export KUBECONFIG
- mkdir -p "$HOME/.kube"
- kind get kubeconfig --name="voltha-$NAME" >"$KUBECONFIG"
- fi
+ KUBECONFIG_TMP=$(mktemp)
+ kind get kubeconfig --name="voltha-$NAME" >"$KUBECONFIG_TMP"
+ mkdir -p "$HOME/.kube"
+ KUBECONFIG="$HOME/.kube/kind-config-voltha-$NAME"; export KUBECONFIG
+ cp "$KUBECONFIG_TMP" "$KUBECONFIG"
+ rm -rf "$KUBECONFIG_TMP"
echo "export KUBECONFIG=\"$KUBECONFIG\"" | tee -a "$LOG"
fi
echo "export PATH=$GOPATH/bin:\$PATH" | tee -a "$LOG"