mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Read ssh username from env variable
Signed-off-by: Harshal Patil <harpatil@redhat.com>
This commit is contained in:
parent
ebbbc57540
commit
9d5ca30b76
@ -19,6 +19,7 @@ package remote
|
|||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"os/user"
|
"os/user"
|
||||||
"strings"
|
"strings"
|
||||||
@ -68,6 +69,11 @@ func GetHostnameOrIP(hostname string) string {
|
|||||||
if ip, found := hostnameIPOverrides.m[hostname]; found {
|
if ip, found := hostnameIPOverrides.m[hostname]; found {
|
||||||
host = ip
|
host = ip
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *sshUser == "" {
|
||||||
|
*sshUser = os.Getenv("KUBE_SSH_USER")
|
||||||
|
}
|
||||||
|
|
||||||
if *sshUser != "" {
|
if *sshUser != "" {
|
||||||
host = fmt.Sprintf("%s@%s", *sshUser, host)
|
host = fmt.Sprintf("%s@%s", *sshUser, host)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user