Skip to content

Commit

Permalink
Don't cordon all workers at once when upgrading (#672)
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <[email protected]>
  • Loading branch information
kke authored Mar 28, 2024
1 parent 6e354db commit 0a6a075
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions phase/upgrade_workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,21 @@ func (p *UpgradeWorkers) CleanUp() {

// Run the phase
func (p *UpgradeWorkers) Run() error {
if err := p.hosts.Each(p.cordonWorker); err != nil {
return err
}

// Upgrade worker hosts parallelly in 10% chunks
concurrentUpgrades := int(math.Floor(float64(len(p.hosts)) * 0.10))
if concurrentUpgrades == 0 {
concurrentUpgrades = 1
}

log.Infof("Upgrading max %d workers in parallel", concurrentUpgrades)
return p.hosts.BatchedParallelEach(concurrentUpgrades,
err := p.hosts.BatchedParallelEach(concurrentUpgrades,
p.start,
p.cordonWorker,
)
if err != nil {
return err
}
return p.hosts.BatchedParallelEach(concurrentUpgrades,
p.drainWorker,
p.upgradeWorker,
p.uncordonWorker,
Expand Down

0 comments on commit 0a6a075

Please sign in to comment.