Skip to content

Commit e3c702c

Browse files
authored
Merge pull request #4384 from k8s-infra-cherrypick-robot/cherry-pick-4381-to-release-1.11
[release-1.11] hack: Use absolute path for SSH key vars
2 parents 6d656f9 + 6da8dcf commit e3c702c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

hack/util.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,21 @@ capz::util::generate_ssh_key() {
8282
AZURE_SSH_PUBLIC_KEY_FILE=${AZURE_SSH_PUBLIC_KEY_FILE:-""}
8383
if [ -z "${AZURE_SSH_PUBLIC_KEY_FILE}" ]; then
8484
echo "generating sshkey for e2e"
85-
AZURE_SSH_KEY=.sshkey
85+
AZURE_SSH_KEY="${PWD}"/.sshkey
86+
# This is required if e2e.test is run with --provider=skeleton. This option is used when
87+
# running Windows e2e tests against a CAPZ cluster to ensure no extra Azure resources are
88+
# created by e2e.test.
89+
# Ref: https://github.com/kubernetes-sigs/windows-testing/blob/be73dd57a551be4f9527e7a3a3e6491e86cae6d2/capz/run-capz-e2e.sh#L300
90+
# Further more, --provider is what decides which SSH environment variable is used to create
91+
# the signer needed to SSH into nodes.
92+
# Ref: https://github.com/kubernetes/kubernetes/blob/41890534532931742770a7dc98f78bcdc59b1a6f/test/e2e/framework/ssh/ssh.go#L58
93+
KUBE_SSH_KEY="${AZURE_SSH_KEY}"
8694
rm -f "${AZURE_SSH_KEY}" 2>/dev/null
8795
ssh-keygen -t rsa -b 2048 -f "${AZURE_SSH_KEY}" -N '' 1>/dev/null
8896
AZURE_SSH_PUBLIC_KEY_FILE="${AZURE_SSH_KEY}.pub"
8997
# This is needed to run tests that required SSH access to nodes
9098
export AZURE_SSH_KEY
99+
export KUBE_SSH_KEY
91100
fi
92101
AZURE_SSH_PUBLIC_KEY_B64=$(base64 < "${AZURE_SSH_PUBLIC_KEY_FILE}" | tr -d '\r\n')
93102
export AZURE_SSH_PUBLIC_KEY_B64

0 commit comments

Comments
 (0)