Merge pull request #7941 from prksu/fix-panic-when-ssh-key-not-exists-on-do

Fix panic when ssh key not exists on digitalocean
This commit is contained in:
Kubernetes Prow Robot 2019-11-20 13:39:19 -08:00 committed by GitHub
commit 3ef957322e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -385,6 +385,10 @@ func (c *ApplyClusterCmd) Run() error {
return fmt.Errorf("DigitalOcean support is currently (very) alpha and is feature-gated. export KOPS_FEATURE_FLAGS=AlphaAllowDO to enable it")
}
if len(sshPublicKeys) == 0 && c.Cluster.Spec.SSHKeyName == "" {
return fmt.Errorf("SSH public key must be specified when running with DigitalOcean (create with `kops create secret --name %s sshpublickey admin -i ~/.ssh/id_rsa.pub`)", cluster.ObjectMeta.Name)
}
modelContext.SSHPublicKeys = sshPublicKeys
l.AddTypes(map[string]interface{}{