mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 02:41:25 +00:00
Merge pull request #76059 from tedyu/master
Remove unnecessary map in cleanupHistory
This commit is contained in:
commit
a78ae4ba74
@ -160,21 +160,13 @@ func (dsc *DaemonSetsController) cleanupHistory(ds *apps.DaemonSet, old []*apps.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find all live history with the above hashes
|
|
||||||
liveHistory := make(map[string]bool)
|
|
||||||
for _, history := range old {
|
|
||||||
if hash := history.Labels[apps.DefaultDaemonSetUniqueLabelKey]; liveHashes[hash] {
|
|
||||||
liveHistory[history.Name] = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clean up old history from smallest to highest revision (from oldest to newest)
|
// Clean up old history from smallest to highest revision (from oldest to newest)
|
||||||
sort.Sort(historiesByRevision(old))
|
sort.Sort(historiesByRevision(old))
|
||||||
for _, history := range old {
|
for _, history := range old {
|
||||||
if toKill <= 0 {
|
if toKill <= 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if liveHistory[history.Name] {
|
if hash := history.Labels[apps.DefaultDaemonSetUniqueLabelKey]; liveHashes[hash] {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// Clean up
|
// Clean up
|
||||||
|
Loading…
Reference in New Issue
Block a user