From eebd8d26907e97f3faf8a73f0f81a096e34e79b1 Mon Sep 17 00:00:00 2001 From: Ted Yu Date: Tue, 2 Apr 2019 15:45:46 -0700 Subject: [PATCH] Remove unnecessary map in cleanupHistory --- pkg/controller/daemon/update.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/pkg/controller/daemon/update.go b/pkg/controller/daemon/update.go index 10bf24cf491..f45472ee959 100644 --- a/pkg/controller/daemon/update.go +++ b/pkg/controller/daemon/update.go @@ -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) sort.Sort(historiesByRevision(old)) for _, history := range old { if toKill <= 0 { break } - if liveHistory[history.Name] { + if hash := history.Labels[apps.DefaultDaemonSetUniqueLabelKey]; liveHashes[hash] { continue } // Clean up