mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
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.
This commit is contained in:
parent
c6ae7ae3b2
commit
d09a655c4c
@ -31,6 +31,11 @@ import (
|
|||||||
// GetSigner returns an ssh.Signer for the provider ("gce", etc.) that can be
|
// GetSigner returns an ssh.Signer for the provider ("gce", etc.) that can be
|
||||||
// used to SSH to their nodes.
|
// used to SSH to their nodes.
|
||||||
func GetSigner(provider string) (ssh.Signer, error) {
|
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,
|
// 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
|
// please also add them to any SSH tests that are disabled because of signer
|
||||||
// support.
|
// support.
|
||||||
|
Loading…
Reference in New Issue
Block a user