Merge pull request #11065 from rifelpet/kubetest2

Kubetest2 - Add GCE default SSH key values from prow jobs
This commit is contained in:
Kubernetes Prow Robot 2021-03-17 20:55:19 -07:00 committed by GitHub
commit cad169e1d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 7 deletions

View File

@ -61,13 +61,25 @@ func (d *deployer) initialize() error {
d.KopsBinaryPath = binaryPath
d.KopsBaseURL = baseURL
}
// These environment variables are defined by the "preset-aws-ssh" prow preset
// https://github.com/kubernetes/test-infra/blob/3d3b325c98b739b526ba5d93ce21c90a05e1f46d/config/prow/config.yaml#L653-L670
if d.SSHPrivateKeyPath == "" {
d.SSHPrivateKeyPath = os.Getenv("AWS_SSH_PRIVATE_KEY_FILE")
}
if d.SSHPublicKeyPath == "" {
d.SSHPublicKeyPath = os.Getenv("AWS_SSH_PUBLIC_KEY_FILE")
switch d.CloudProvider {
case "aws":
// These environment variables are defined by the "preset-aws-ssh" prow preset
// https://github.com/kubernetes/test-infra/blob/3d3b325c98b739b526ba5d93ce21c90a05e1f46d/config/prow/config.yaml#L653-L670
if d.SSHPrivateKeyPath == "" {
d.SSHPrivateKeyPath = os.Getenv("AWS_SSH_PRIVATE_KEY_FILE")
}
if d.SSHPublicKeyPath == "" {
d.SSHPublicKeyPath = os.Getenv("AWS_SSH_PUBLIC_KEY_FILE")
}
case "gce":
// These environment variables are defined by the "preset-k8s-ssh" prow preset
// https://github.com/kubernetes/test-infra/blob/432c6e7dca38f0785901a6159275524cec369c4a/config/prow/config.yaml#L639-L656
if d.SSHPrivateKeyPath == "" {
d.SSHPrivateKeyPath = os.Getenv("JENKINS_GCE_SSH_PRIVATE_KEY_FILE")
}
if d.SSHPublicKeyPath == "" {
d.SSHPublicKeyPath = os.Getenv("JENKINS_GCE_SSH_PUBLIC_KEY_FILE")
}
}
if d.SSHUser == "" {
d.SSHUser = os.Getenv("KUBE_SSH_USER")