mirror of https://github.com/kubernetes/kops.git
Refactor LaunchTemplate.HTTPTokens
This commit is contained in:
parent
98502cd0b2
commit
07aa346e68
|
@ -145,6 +145,7 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateTask(c *fi.ModelBuilde
|
|||
Lifecycle: b.Lifecycle,
|
||||
CPUCredits: fi.String(fi.StringValue(ig.Spec.CPUCredits)),
|
||||
HTTPPutResponseHopLimit: fi.Int64(1),
|
||||
HTTPTokens: fi.String(ec2.LaunchTemplateHttpTokensStateOptional),
|
||||
IAMInstanceProfile: lc.IAMInstanceProfile,
|
||||
ImageID: lc.ImageID,
|
||||
InstanceMonitoring: lc.InstanceMonitoring,
|
||||
|
@ -159,7 +160,6 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateTask(c *fi.ModelBuilde
|
|||
Tags: tags,
|
||||
Tenancy: lc.Tenancy,
|
||||
UserData: lc.UserData,
|
||||
HTTPTokens: lc.HTTPTokens,
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -225,6 +225,10 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateTask(c *fi.ModelBuilde
|
|||
lt.HTTPPutResponseHopLimit = ig.Spec.InstanceMetadata.HTTPPutResponseHopLimit
|
||||
}
|
||||
|
||||
if ig.Spec.InstanceMetadata != nil && ig.Spec.InstanceMetadata.HTTPTokens != nil {
|
||||
lt.HTTPTokens = ig.Spec.InstanceMetadata.HTTPTokens
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
@ -316,11 +320,6 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateHelper(c *fi.ModelBuil
|
|||
SecurityGroups: []*awstasks.SecurityGroup{sgLink},
|
||||
}
|
||||
|
||||
t.HTTPTokens = fi.String(ec2.LaunchTemplateHttpTokensStateOptional)
|
||||
if ig.Spec.InstanceMetadata != nil && ig.Spec.InstanceMetadata.HTTPTokens != nil {
|
||||
t.HTTPTokens = ig.Spec.InstanceMetadata.HTTPTokens
|
||||
}
|
||||
|
||||
if ig.HasAPIServer() &&
|
||||
b.APILoadBalancerClass() == kops.LoadBalancerClassNetwork {
|
||||
for _, id := range b.Cluster.Spec.API.LoadBalancer.AdditionalSecurityGroups {
|
||||
|
|
Loading…
Reference in New Issue