mirror of https://github.com/kubernetes/kops.git
Refactor LaunchTemplate.IAMInstanceProfile
This commit is contained in:
parent
07aa346e68
commit
bfd8034cce
|
@ -135,6 +135,12 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateTask(c *fi.ModelBuilde
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @step: add the iam instance profile
|
||||||
|
link, err := b.LinkToIAMInstanceProfile(ig)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to find IAM profile link for instance group %q: %w", ig.ObjectMeta.Name, err)
|
||||||
|
}
|
||||||
|
|
||||||
tags, err := b.CloudTagsForInstanceGroup(ig)
|
tags, err := b.CloudTagsForInstanceGroup(ig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error building cloud tags: %v", err)
|
return nil, fmt.Errorf("error building cloud tags: %v", err)
|
||||||
|
@ -146,7 +152,7 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateTask(c *fi.ModelBuilde
|
||||||
CPUCredits: fi.String(fi.StringValue(ig.Spec.CPUCredits)),
|
CPUCredits: fi.String(fi.StringValue(ig.Spec.CPUCredits)),
|
||||||
HTTPPutResponseHopLimit: fi.Int64(1),
|
HTTPPutResponseHopLimit: fi.Int64(1),
|
||||||
HTTPTokens: fi.String(ec2.LaunchTemplateHttpTokensStateOptional),
|
HTTPTokens: fi.String(ec2.LaunchTemplateHttpTokensStateOptional),
|
||||||
IAMInstanceProfile: lc.IAMInstanceProfile,
|
IAMInstanceProfile: link,
|
||||||
ImageID: lc.ImageID,
|
ImageID: lc.ImageID,
|
||||||
InstanceMonitoring: lc.InstanceMonitoring,
|
InstanceMonitoring: lc.InstanceMonitoring,
|
||||||
InstanceType: lc.InstanceType,
|
InstanceType: lc.InstanceType,
|
||||||
|
@ -300,16 +306,9 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateHelper(c *fi.ModelBuil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @step: add the iam instance profile
|
|
||||||
link, err := b.LinkToIAMInstanceProfile(ig)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("unable to find IAM profile link for instance group %q: %w", ig.ObjectMeta.Name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
t := &awstasks.LaunchTemplate{
|
t := &awstasks.LaunchTemplate{
|
||||||
Name: fi.String(name),
|
Name: fi.String(name),
|
||||||
Lifecycle: b.Lifecycle,
|
Lifecycle: b.Lifecycle,
|
||||||
IAMInstanceProfile: link,
|
|
||||||
ImageID: fi.String(ig.Spec.Image),
|
ImageID: fi.String(ig.Spec.Image),
|
||||||
InstanceMonitoring: ig.Spec.DetailedInstanceMonitoring,
|
InstanceMonitoring: ig.Spec.DetailedInstanceMonitoring,
|
||||||
InstanceType: fi.String(strings.Split(ig.Spec.MachineType, ",")[0]),
|
InstanceType: fi.String(strings.Split(ig.Spec.MachineType, ",")[0]),
|
||||||
|
|
Loading…
Reference in New Issue