mirror of https://github.com/kubernetes/kops.git
Merge pull request #10560 from spotinst/fix-launchspec-strategy
Spotinst: Iterate over metadata labels only once
This commit is contained in:
commit
06a533ed04
|
@ -511,7 +511,7 @@ func (b *InstanceGroupModelBuilder) buildLaunchSpec(c *fi.ModelBuilderContext,
|
|||
Ocean: ocean, // link to Ocean
|
||||
}
|
||||
|
||||
// Instance types.
|
||||
// Instance types and strategy.
|
||||
for k, v := range ig.ObjectMeta.Labels {
|
||||
switch k {
|
||||
case InstanceGroupLabelOceanInstanceTypesWhitelist, InstanceGroupLabelOceanInstanceTypes:
|
||||
|
@ -519,6 +519,12 @@ func (b *InstanceGroupModelBuilder) buildLaunchSpec(c *fi.ModelBuilderContext,
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
case InstanceGroupLabelSpotPercentage:
|
||||
launchSpec.SpotPercentage, err = parseInt(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -587,17 +593,6 @@ func (b *InstanceGroupModelBuilder) buildLaunchSpec(c *fi.ModelBuilderContext,
|
|||
}
|
||||
}
|
||||
|
||||
// Strategy.
|
||||
for k, v := range ig.ObjectMeta.Labels {
|
||||
switch k {
|
||||
case InstanceGroupLabelSpotPercentage:
|
||||
launchSpec.SpotPercentage, err = parseInt(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
klog.V(4).Infof("Adding task: LaunchSpec/%s", fi.StringValue(launchSpec.Name))
|
||||
c.AddTask(launchSpec)
|
||||
|
||||
|
|
Loading…
Reference in New Issue