mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #40319 from jeffvance/e2e-ssh-local
Automatic merge from submit-queue (batch tested with PRs 40584, 40319) ssh support for local **What this PR does / why we need it**: adds local deployment support for e2e tests. Useful for non-cloud, simple testing. **Special notes for your reviewer**: Formerly this pr was part of #38214 **Release note**: ``` NONE ```
This commit is contained in:
commit
f83223091f
@ -376,10 +376,10 @@ func SkipIfMissingResource(clientPool dynamic.ClientPool, gvr schema.GroupVersio
|
||||
}
|
||||
|
||||
// ProvidersWithSSH are those providers where each node is accessible with SSH
|
||||
var ProvidersWithSSH = []string{"gce", "gke", "aws"}
|
||||
var ProvidersWithSSH = []string{"gce", "gke", "aws", "local"}
|
||||
|
||||
// providersWithMasterSSH are those providers where master node is accessible with SSH
|
||||
var providersWithMasterSSH = []string{"gce", "gke", "kubemark", "aws"}
|
||||
var providersWithMasterSSH = []string{"gce", "gke", "kubemark", "aws", "local"}
|
||||
|
||||
type podCondition func(pod *v1.Pod) (bool, error)
|
||||
|
||||
@ -3872,6 +3872,7 @@ func GetSigner(provider string) (ssh.Signer, error) {
|
||||
// please also add them to any SSH tests that are disabled because of signer
|
||||
// support.
|
||||
keyfile := ""
|
||||
key := ""
|
||||
switch provider {
|
||||
case "gce", "gke", "kubemark":
|
||||
keyfile = "google_compute_engine"
|
||||
@ -3884,15 +3885,23 @@ func GetSigner(provider string) (ssh.Signer, error) {
|
||||
// Otherwise revert to home dir
|
||||
keyfile = "kube_aws_rsa"
|
||||
case "vagrant":
|
||||
keyfile := os.Getenv("VAGRANT_SSH_KEY")
|
||||
keyfile = os.Getenv("VAGRANT_SSH_KEY")
|
||||
if len(keyfile) != 0 {
|
||||
return sshutil.MakePrivateKeySignerFromFile(keyfile)
|
||||
}
|
||||
return nil, fmt.Errorf("VAGRANT_SSH_KEY env variable should be provided")
|
||||
case "local":
|
||||
keyfile = os.Getenv("LOCAL_SSH_KEY") // maybe?
|
||||
if len(keyfile) == 0 {
|
||||
keyfile = "id_rsa"
|
||||
}
|
||||
default:
|
||||
return nil, fmt.Errorf("GetSigner(...) not implemented for %s", provider)
|
||||
}
|
||||
key := filepath.Join(keydir, keyfile)
|
||||
|
||||
if len(key) == 0 {
|
||||
key = filepath.Join(keydir, keyfile)
|
||||
}
|
||||
|
||||
return sshutil.MakePrivateKeySignerFromFile(key)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user