mirror of https://github.com/kubernetes/kops.git
fix(spot/ocean): default instance group should be optional
This commit is contained in:
parent
da710a0c3c
commit
0cfa2bb6a7
|
|
@ -323,7 +323,7 @@ func (b *InstanceGroupModelBuilder) buildOcean(c *fi.ModelBuilderContext, igs ..
|
||||||
{
|
{
|
||||||
// Single instance group.
|
// Single instance group.
|
||||||
if len(igs) == 1 {
|
if len(igs) == 1 {
|
||||||
ig = igs[0]
|
ig = igs[0].DeepCopy()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multiple instance groups.
|
// Multiple instance groups.
|
||||||
|
|
@ -343,22 +343,25 @@ func (b *InstanceGroupModelBuilder) buildOcean(c *fi.ModelBuilderContext, igs ..
|
||||||
InstanceGroupLabelOceanDefaultLaunchSpec)
|
InstanceGroupLabelOceanDefaultLaunchSpec)
|
||||||
}
|
}
|
||||||
|
|
||||||
ig = g
|
ig = g.DeepCopy()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No default instance group. Use the first one.
|
||||||
if ig == nil {
|
if ig == nil {
|
||||||
return fmt.Errorf("unable to detect default launch spec: "+
|
ig = igs[0].DeepCopy()
|
||||||
"please label the desired default instance group with `%s: \"true\"`",
|
|
||||||
InstanceGroupLabelOceanDefaultLaunchSpec)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
klog.V(4).Infof("Detected default launch spec: %q", b.AutoscalingGroupName(ig))
|
klog.V(4).Infof("Detected default launch spec: %q", b.AutoscalingGroupName(ig))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rename the instance group to avoid duplicate tasks with same name.
|
||||||
|
ig.Name = fi.StringValue(ocean.Name)
|
||||||
|
|
||||||
// Image.
|
// Image.
|
||||||
ocean.ImageID = fi.String(ig.Spec.Image)
|
ocean.ImageID = fi.String(ig.Spec.Image)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue