mirror of https://github.com/kubernetes/kops.git
Allow disabling warm pool by setting WarmPool.MaxSize to 0
This commit is contained in:
parent
09276d47e6
commit
044b5f6d0d
|
|
@ -199,6 +199,10 @@ type WarmPoolSpec struct {
|
|||
EnableLifecyleHook bool `json:"enableLifecycleHook,omitempty"`
|
||||
}
|
||||
|
||||
func (in *WarmPoolSpec) IsEnabled() bool {
|
||||
return in != nil && (in.MaxSize == nil || *in.MaxSize != 0)
|
||||
}
|
||||
|
||||
const (
|
||||
// SpotAllocationStrategyLowestPrices indicates a lowest-price strategy
|
||||
SpotAllocationStrategyLowestPrices = "lowest-price"
|
||||
|
|
|
|||
|
|
@ -89,12 +89,12 @@ func (b *AutoscalingGroupModelBuilder) Build(c *fi.ModelBuilderContext) error {
|
|||
|
||||
warmPool := ig.Spec.WarmPool
|
||||
{
|
||||
enabled := fi.Bool(warmPool != nil)
|
||||
enabled := fi.Bool(warmPool.IsEnabled())
|
||||
warmPoolTask := &awstasks.WarmPool{
|
||||
Name: &name,
|
||||
Enabled: enabled,
|
||||
}
|
||||
if warmPool != nil {
|
||||
if warmPool.IsEnabled() {
|
||||
warmPoolTask.MinSize = warmPool.MinSize
|
||||
warmPoolTask.MaxSize = warmPool.MaxSize
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ func (b *IAMModelBuilder) Build(c *fi.ModelBuilderContext) error {
|
|||
for profileARN, igRole := range sharedProfileARNsToIGRole {
|
||||
lchPermissions := false
|
||||
for _, ig := range b.InstanceGroups {
|
||||
if ig.Spec.Role == igRole && ig.Spec.WarmPool != nil && ig.Spec.WarmPool.EnableLifecyleHook {
|
||||
if ig.Spec.Role == igRole && ig.Spec.WarmPool.IsEnabled() && ig.Spec.WarmPool.EnableLifecyleHook {
|
||||
lchPermissions = true
|
||||
break
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ func (b *IAMModelBuilder) Build(c *fi.ModelBuilderContext) error {
|
|||
for igRole := range managedRoles {
|
||||
warmPool := false
|
||||
for _, ig := range b.InstanceGroups {
|
||||
if ig.Spec.Role == igRole && ig.Spec.WarmPool != nil && ig.Spec.WarmPool.EnableLifecyleHook {
|
||||
if ig.Spec.Role == igRole && ig.Spec.WarmPool.IsEnabled() && ig.Spec.WarmPool.EnableLifecyleHook {
|
||||
warmPool = true
|
||||
break
|
||||
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ func (c *NodeUpCommand) Run(out io.Writer) error {
|
|||
klog.Exitf("error closing target: %v", err)
|
||||
}
|
||||
|
||||
if modelContext.InstanceGroup.Spec.WarmPool != nil && modelContext.InstanceGroup.Spec.WarmPool.EnableLifecyleHook {
|
||||
if modelContext.InstanceGroup.Spec.WarmPool.IsEnabled() && modelContext.InstanceGroup.Spec.WarmPool.EnableLifecyleHook {
|
||||
if api.CloudProviderID(c.cluster.Spec.CloudProvider) == api.CloudProviderAWS {
|
||||
err := completeWarmingLifecycleAction(cloud.(awsup.AWSCloud), modelContext)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue