Read ssh username from env variable

Signed-off-by: Harshal Patil <harpatil@redhat.com>
This commit is contained in:
Harshal Patil 2020-08-17 17:38:47 +05:30
parent ebbbc57540
commit 9d5ca30b76

View File

@ -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)
}