From d09a655c4ccd543f07fa4394c6ff30179eb8b35a Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Fri, 21 Dec 2018 16:10:22 -0500 Subject: [PATCH] Allow a single SSH key to be used in all providers Support KUBE_SSH_KEY_PATH as a single environment variable that if specified ignores the provider specific settinsg and loads the SSH private key from the provided path. Makes it much easier to specify a consistent signer across providers. --- test/e2e/framework/ssh.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/e2e/framework/ssh.go b/test/e2e/framework/ssh.go index b4f606143ce..fc1e1ca8149 100644 --- a/test/e2e/framework/ssh.go +++ b/test/e2e/framework/ssh.go @@ -31,6 +31,11 @@ import ( // GetSigner returns an ssh.Signer for the provider ("gce", etc.) that can be // used to SSH to their nodes. func GetSigner(provider string) (ssh.Signer, error) { + // honor a consistent SSH key across all providers + if path := os.Getenv("KUBE_SSH_KEY_PATH"); len(path) > 0 { + return sshutil.MakePrivateKeySignerFromFile(path) + } + // Select the key itself to use. When implementing more providers here, // please also add them to any SSH tests that are disabled because of signer // support.