Fix panic when ssh key not exists on digitalocean

This commit is contained in:
Ahmad Nurus S 2019-11-18 02:24:58 +07:00
parent 644df24b6f
commit cc3f8aa88d
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{}{