Merge pull request #94049 from harche/ssh_user

Read ssh username from env variable
This commit is contained in:
Kubernetes Prow Robot
2020-08-26 18:23:02 -07:00
committed by GitHub

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