From 074745b2035b4b0cf14d4fc2d30fb9cd36a714c1 Mon Sep 17 00:00:00 2001 From: "Yasin, Sirajudeen (SY495P)" Date: Mon, 16 Sep 2019 12:04:01 -0700 Subject: [PATCH] [kubectl] - Added env KUBECONFIG for kubectl kubectl_cmd uses ssh_cmd to run kubectl over ssh. ssh_cmd does not allow to pass extra env vars in command. So updated to use ssh_cmd_raw with env KUBECONFIG set Change-Id: I1f2391a79002db15785644e10e673936c3dff4ed --- tools/multi_nodes_gate/airship_gate/lib/kube.sh | 5 +++-- .../airship_gate/on_error/collect_genesis_info.sh | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/multi_nodes_gate/airship_gate/lib/kube.sh b/tools/multi_nodes_gate/airship_gate/lib/kube.sh index 5ab18819..05cf3c70 100644 --- a/tools/multi_nodes_gate/airship_gate/lib/kube.sh +++ b/tools/multi_nodes_gate/airship_gate/lib/kube.sh @@ -3,7 +3,7 @@ kubectl_apply() { VIA=${1} FILE=${2} - ssh_cmd "${VIA}" "cat ${FILE} | kubectl apply -f -" + ssh_cmd_raw "${VIA}" "KUBECONFIG=${KUBECONFIG}" "cat ${FILE} | kubectl apply -f -" } kubectl_cmd() { @@ -11,7 +11,8 @@ kubectl_cmd() { shift - ssh_cmd "${VIA}" kubectl "${@}" + ssh_cmd_raw "${VIA}" "KUBECONFIG=${KUBECONFIG}" kubectl "${@}" + } kubectl_wait_for_pod() { diff --git a/tools/multi_nodes_gate/airship_gate/on_error/collect_genesis_info.sh b/tools/multi_nodes_gate/airship_gate/on_error/collect_genesis_info.sh index 3312ae82..26d6bfc9 100755 --- a/tools/multi_nodes_gate/airship_gate/on_error/collect_genesis_info.sh +++ b/tools/multi_nodes_gate/airship_gate/on_error/collect_genesis_info.sh @@ -17,6 +17,7 @@ set +e set -x +KUBECONFIG="${KUBECONFIG:-/etc/kubernetes/admin/kubeconfig.yaml}" source "${GATE_UTILS}" ERROR_DIR="${TEMP_DIR}/errors"