Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ type NodeGroupState struct {
taintTracker []string
forceTaintTracker []string

// tracks when nodes were last untainted, keyed by node name
untaintTracker map[string]time.Time

// used for tracking scale delta across runs, useful for reducing hysteresis
scaleDelta int
lastScaleOut time.Time
Expand Down Expand Up @@ -100,7 +103,8 @@ func NewController(opts Opts, stopChan <-chan struct{}) (*Controller, error) {
minimumLockDuration: nodeGroupOpts.ScaleUpCoolDownPeriodDuration(),
nodegroup: nodeGroupOpts.Name,
},
scaleDelta: 0,
scaleDelta: 0,
untaintTracker: make(map[string]time.Time),
}
}

Expand Down Expand Up @@ -222,6 +226,19 @@ func (c *Controller) scaleNodeGroup(nodegroup string, nodeGroup *NodeGroupState)
return 0, err
}

// Clean up untaint tracker for nodes that no longer exist
if len(nodeGroup.untaintTracker) > 0 {
activeNodes := make(map[string]bool, len(allNodes))
for _, node := range allNodes {
activeNodes[node.Name] = true
}
for name := range nodeGroup.untaintTracker {
if !activeNodes[name] {
delete(nodeGroup.untaintTracker, name)
}
}
}

// store a cached version of node capacity
if len(allNodes) > 0 {
nodeGroup.cpuCapacity = *allNodes[0].Status.Allocatable.Cpu()
Expand Down
Loading
Loading