mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Add flag to node e2e test specifying location of ssh privkey
This commit is contained in:
parent
1955ed614f
commit
30a5efa33b
@ -36,6 +36,7 @@ cluster/photon-controller/templates/salt-minion.sh: hostname_override: $(ip rou
|
|||||||
cluster/photon-controller/util.sh: node_ip=$(${PHOTON} vm networks "${node_id}" | grep -i $'\t'"00:0C:29" | grep -E '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -1 | awk -F'\t' '{print $3}')
|
cluster/photon-controller/util.sh: node_ip=$(${PHOTON} vm networks "${node_id}" | grep -i $'\t'"00:0C:29" | grep -E '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -1 | awk -F'\t' '{print $3}')
|
||||||
cluster/photon-controller/util.sh: local cert_dir="/srv/kubernetes"
|
cluster/photon-controller/util.sh: local cert_dir="/srv/kubernetes"
|
||||||
cluster/photon-controller/util.sh: node_name=${1}
|
cluster/photon-controller/util.sh: node_name=${1}
|
||||||
|
cluster/photon-controller/util.sh: ssh_key=$(ssh-add -L | head -1)
|
||||||
cluster/rackspace/util.sh: local node_ip=$(nova show --minimal ${NODE_NAMES[$i]} \
|
cluster/rackspace/util.sh: local node_ip=$(nova show --minimal ${NODE_NAMES[$i]} \
|
||||||
cluster/saltbase/salt/cluster-autoscaler/cluster-autoscaler.manifest:{% set params = pillar['autoscaler_mig_config'] + " " + cloud_config -%}
|
cluster/saltbase/salt/cluster-autoscaler/cluster-autoscaler.manifest:{% set params = pillar['autoscaler_mig_config'] + " " + cloud_config -%}
|
||||||
cluster/saltbase/salt/etcd/etcd.manifest: "value": "{{ storage_backend }}"
|
cluster/saltbase/salt/etcd/etcd.manifest: "value": "{{ storage_backend }}"
|
||||||
|
@ -573,6 +573,7 @@ sort-by
|
|||||||
source-file
|
source-file
|
||||||
ssh-env
|
ssh-env
|
||||||
ssh-keyfile
|
ssh-keyfile
|
||||||
|
ssh-key
|
||||||
ssh-options
|
ssh-options
|
||||||
ssh-user
|
ssh-user
|
||||||
start-services
|
start-services
|
||||||
|
@ -29,9 +29,11 @@ import (
|
|||||||
|
|
||||||
var sshOptions = flag.String("ssh-options", "", "Commandline options passed to ssh.")
|
var sshOptions = flag.String("ssh-options", "", "Commandline options passed to ssh.")
|
||||||
var sshEnv = flag.String("ssh-env", "", "Use predefined ssh options for environment. Options: gce")
|
var sshEnv = flag.String("ssh-env", "", "Use predefined ssh options for environment. Options: gce")
|
||||||
|
var sshKey = flag.String("ssh-key", "", "Path to ssh private key.")
|
||||||
var sshUser = flag.String("ssh-user", "", "Use predefined user for ssh.")
|
var sshUser = flag.String("ssh-user", "", "Use predefined user for ssh.")
|
||||||
|
|
||||||
var sshOptionsMap map[string]string
|
var sshOptionsMap map[string]string
|
||||||
|
var sshDefaultKeyMap map[string]string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
usr, err := user.Current()
|
usr, err := user.Current()
|
||||||
@ -39,7 +41,10 @@ func init() {
|
|||||||
glog.Fatal(err)
|
glog.Fatal(err)
|
||||||
}
|
}
|
||||||
sshOptionsMap = map[string]string{
|
sshOptionsMap = map[string]string{
|
||||||
"gce": fmt.Sprintf("-i %s/.ssh/google_compute_engine -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o CheckHostIP=no -o StrictHostKeyChecking=no -o ServerAliveInterval=30 -o LogLevel=ERROR", usr.HomeDir),
|
"gce": "-o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o CheckHostIP=no -o StrictHostKeyChecking=no -o ServerAliveInterval=30 -o LogLevel=ERROR",
|
||||||
|
}
|
||||||
|
sshDefaultKeyMap = map[string]string{
|
||||||
|
"gce": fmt.Sprintf("%s/.ssh/google_compute_engine", usr.HomeDir),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,6 +92,11 @@ func SSHNoSudo(host string, cmd ...string) (string, error) {
|
|||||||
|
|
||||||
// runSSHCommand executes the ssh or scp command, adding the flag provided --ssh-options
|
// runSSHCommand executes the ssh or scp command, adding the flag provided --ssh-options
|
||||||
func runSSHCommand(cmd string, args ...string) (string, error) {
|
func runSSHCommand(cmd string, args ...string) (string, error) {
|
||||||
|
if *sshKey != "" {
|
||||||
|
args = append([]string{"-i", *sshKey}, args...)
|
||||||
|
} else if key, found := sshDefaultKeyMap[*sshEnv]; found {
|
||||||
|
args = append([]string{"-i", key}, args...)
|
||||||
|
}
|
||||||
if env, found := sshOptionsMap[*sshEnv]; found {
|
if env, found := sshOptionsMap[*sshEnv]; found {
|
||||||
args = append(strings.Split(env, " "), args...)
|
args = append(strings.Split(env, " "), args...)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user