mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 16:06:51 +00:00
Merge pull request #33268 from deads2k/client-14-rc-svc-lister
Automatic merge from submit-queue simplify RC listers Make the RC and SVC listers use the common list functions that more closely match client APIs, are consistent with other listers, and avoid unnecessary copies.
This commit is contained in:
@@ -269,16 +269,16 @@ func (rm *ReplicationManager) getPodController(pod *api.Pod) *api.ReplicationCon
|
||||
}
|
||||
|
||||
// update lookup cache
|
||||
rm.lookupCache.Update(pod, &controllers[0])
|
||||
rm.lookupCache.Update(pod, controllers[0])
|
||||
|
||||
return &controllers[0]
|
||||
return controllers[0]
|
||||
}
|
||||
|
||||
// isCacheValid check if the cache is valid
|
||||
func (rm *ReplicationManager) isCacheValid(pod *api.Pod, cachedRC *api.ReplicationController) bool {
|
||||
exists, err := rm.rcStore.Exists(cachedRC)
|
||||
_, err := rm.rcStore.ReplicationControllers(cachedRC.Namespace).Get(cachedRC.Name)
|
||||
// rc has been deleted or updated, cache is invalid
|
||||
if err != nil || !exists || !isControllerMatch(pod, cachedRC) {
|
||||
if err != nil || !isControllerMatch(pod, cachedRC) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
||||
@@ -71,7 +71,7 @@ func updateReplicaCount(rcClient unversionedcore.ReplicationControllerInterface,
|
||||
}
|
||||
|
||||
// OverlappingControllers sorts a list of controllers by creation timestamp, using their names as a tie breaker.
|
||||
type OverlappingControllers []api.ReplicationController
|
||||
type OverlappingControllers []*api.ReplicationController
|
||||
|
||||
func (o OverlappingControllers) Len() int { return len(o) }
|
||||
func (o OverlappingControllers) Swap(i, j int) { o[i], o[j] = o[j], o[i] }
|
||||
|
||||
Reference in New Issue
Block a user