mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Remove predicateResults map from podFitsOnNode.
The purpose of this map is to combine two predicate results before writing to the equivalence cache. However, the branch that combines results is unreachable. 1. Combining results happens in the second iteration of the outer loop. 2. There is only a second iteration when podsAdded is true. 3. We skip equiv. cache when podsAdded is true.
This commit is contained in:
parent
ca6b312c97
commit
e67b3225a4
@ -468,7 +468,6 @@ func podFitsOnNode(
|
||||
eCacheAvailable bool
|
||||
failedPredicates []algorithm.PredicateFailureReason
|
||||
)
|
||||
predicateResults := make(map[string]HostPredicate)
|
||||
|
||||
podsAdded := false
|
||||
// We run predicates twice in some cases. If the node has greater or equal priority
|
||||
@ -532,20 +531,11 @@ func podFitsOnNode(
|
||||
}
|
||||
|
||||
if eCacheAvailable {
|
||||
// Store data to update equivClassCacheafter this loop.
|
||||
if res, exists := predicateResults[predicateKey]; exists {
|
||||
res.Fit = res.Fit && fit
|
||||
res.FailReasons = append(res.FailReasons, reasons...)
|
||||
predicateResults[predicateKey] = res
|
||||
} else {
|
||||
predicateResults[predicateKey] = HostPredicate{Fit: fit, FailReasons: reasons}
|
||||
}
|
||||
// Skip update if NodeInfo is stale.
|
||||
if cache != nil && cache.IsUpToDate(info) {
|
||||
result := predicateResults[predicateKey]
|
||||
ecache.UpdateCachedPredicateItem(
|
||||
pod.GetName(), info.Node().GetName(),
|
||||
predicateKey, result.Fit, result.FailReasons, equivCacheInfo.hash, false)
|
||||
predicateKey, fit, reasons, equivCacheInfo.hash, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user