diff --git a/pkg/model/gcemodel/autoscalinggroup.go b/pkg/model/gcemodel/autoscalinggroup.go index bf3c82d9a9614..35646697b6620 100644 --- a/pkg/model/gcemodel/autoscalinggroup.go +++ b/pkg/model/gcemodel/autoscalinggroup.go @@ -154,9 +154,13 @@ func (b *AutoscalingGroupModelBuilder) buildInstanceTemplate(c *fi.CloudupModelB } if len(b.SSHPublicKeys) > 0 { + sshUsername := "admin" + if strings.Contains(ig.Spec.Image, "ubuntu") { + sshUsername = "ubuntu" + } var gFmtKeys []string for _, key := range b.SSHPublicKeys { - gFmtKeys = append(gFmtKeys, fmt.Sprintf("%s: %s", fi.SecretNameSSHPrimary, key)) + gFmtKeys = append(gFmtKeys, fmt.Sprintf("%s: %s", sshUsername, key)) } t.Metadata["ssh-keys"] = fi.NewStringResource(strings.Join(gFmtKeys, "\n"))