Merge pull request #105637 from Namanl2001/ssh

adding `--ssh-key` and `--ssh-user` for kubetest2
This commit is contained in:
Kubernetes Prow Robot 2021-10-26 16:33:45 -07:00 committed by GitHub
commit 7c715dbc68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -254,6 +254,7 @@ define TEST_E2E_NODE_HELP_INFO
# GUBERNATOR: For REMOTE=true only. Produce link to Gubernator to view logs.
# Defaults to false.
# TEST_SUITE: For REMOTE=true only. Test suite to use. Defaults to "default".
# SSH_KEY: For REMOTE=true only. Path to SSH key to use.
#
# Example:
# make test-e2e-node FOCUS=Kubelet SKIP=container

View File

@ -47,6 +47,8 @@ timeout_arg=""
system_spec_name=${SYSTEM_SPEC_NAME:-}
extra_envs=${EXTRA_ENVS:-}
runtime_config=${RUNTIME_CONFIG:-}
ssh_user=${SSH_USER:-"${USER}"}
ssh_key=${SSH_KEY:-}
# Parse the flags to pass to ginkgo
ginkgoflags=""
@ -170,6 +172,7 @@ if [ "${remote}" = true ] ; then
--delete-instances="${delete_instances}" --test_args="${test_args}" --instance-metadata="${metadata}" \
--image-config-file="${image_config_file}" --system-spec-name="${system_spec_name}" \
--runtime-config="${runtime_config}" --preemptible-instances="${preemptible_instances}" \
--ssh-user="${ssh_user}" --ssh-key="${ssh_key}" \
--extra-envs="${extra_envs}" --test-suite="${test_suite}" \
"${timeout_arg}" \
2>&1 | tee -i "${artifacts}/build-log.txt"

View File

@ -44,8 +44,12 @@ func init() {
sshOptionsMap = map[string]string{
"gce": "-o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o CheckHostIP=no -o StrictHostKeyChecking=no -o ServerAliveInterval=30 -o LogLevel=ERROR",
}
defaultGceKey := os.Getenv("GCE_SSH_PRIVATE_KEY_FILE")
if defaultGceKey == "" {
defaultGceKey = fmt.Sprintf("%s/.ssh/google_compute_engine", usr.HomeDir)
}
sshDefaultKeyMap = map[string]string{
"gce": fmt.Sprintf("%s/.ssh/google_compute_engine", usr.HomeDir),
"gce": defaultGceKey,
}
}