Skip to content

Commit

Permalink
Merge pull request kubernetes#105637 from Namanl2001/ssh
Browse files Browse the repository at this point in the history
adding `--ssh-key` and `--ssh-user` for kubetest2
  • Loading branch information
k8s-ci-robot authored Oct 26, 2021
2 parents 18cb34e + d721796 commit 7c715db
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions build/root/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions hack/make-rules/test-e2e-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion test/e2e_node/remote/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down

0 comments on commit 7c715db

Please sign in to comment.