mirror of https://github.com/kubernetes/kops.git
Refactor LaunchTemplate.SSHKey
This commit is contained in:
parent
b0bcf40921
commit
4d9018282c
|
@ -184,7 +184,6 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateTask(c *fi.ModelBuilde
|
|||
RootVolumeType: fi.String(rootVolumeType),
|
||||
RootVolumeEncryption: fi.Bool(rootVolumeEncryption),
|
||||
RootVolumeKmsKey: fi.String(rootVolumeKmsKey),
|
||||
SSHKey: lc.SSHKey,
|
||||
SecurityGroups: lc.SecurityGroups,
|
||||
Tags: tags,
|
||||
Tenancy: lc.Tenancy,
|
||||
|
@ -275,6 +274,12 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateTask(c *fi.ModelBuilde
|
|||
lt.RootVolumeIops = nil
|
||||
}
|
||||
|
||||
if b.AWSModelContext.UseSSHKey() {
|
||||
if lt.SSHKey, err = b.LinkToSSHKey(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// When using a MixedInstances ASG, AWS requires the SpotPrice be defined on the ASG
|
||||
// rather than the LaunchTemplate or else it returns this error:
|
||||
// You cannot use a launch template that is set to request Spot Instances (InstanceMarketOptions)
|
||||
|
@ -346,12 +351,6 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateHelper(c *fi.ModelBuil
|
|||
t.SecurityGroups = append(t.SecurityGroups, sgTask)
|
||||
}
|
||||
|
||||
if b.AWSModelContext.UseSSHKey() {
|
||||
if t.SSHKey, err = b.LinkToSSHKey(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// @step: add the instancegroup userdata
|
||||
if t.UserData, err = b.BootstrapScriptBuilder.ResourceNodeUp(c, ig); err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue