From 9d5ca30b763aecd4362e3adda0ad8289819f3989 Mon Sep 17 00:00:00 2001 From: Harshal Patil Date: Mon, 17 Aug 2020 17:38:47 +0530 Subject: [PATCH] Read ssh username from env variable Signed-off-by: Harshal Patil --- test/e2e_node/remote/ssh.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/e2e_node/remote/ssh.go b/test/e2e_node/remote/ssh.go index f1ff1a3b765..e1d7cbb4ed3 100644 --- a/test/e2e_node/remote/ssh.go +++ b/test/e2e_node/remote/ssh.go @@ -19,6 +19,7 @@ package remote import ( "flag" "fmt" + "os" "os/exec" "os/user" "strings" @@ -68,6 +69,11 @@ func GetHostnameOrIP(hostname string) string { if ip, found := hostnameIPOverrides.m[hostname]; found { host = ip } + + if *sshUser == "" { + *sshUser = os.Getenv("KUBE_SSH_USER") + } + if *sshUser != "" { host = fmt.Sprintf("%s@%s", *sshUser, host) }