RC/RS: Fix ignoring inactive Pods.
This commit is contained in:
@@ -571,13 +571,13 @@ func (rm *ReplicationManager) syncReplicationController(key string) error {
|
||||
// list all pods to include the pods that don't match the rc's selector
|
||||
// anymore but has the stale controller ref.
|
||||
// TODO: Do the List and Filter in a single pass, or use an index.
|
||||
pods, err := rm.podLister.Pods(rc.Namespace).List(labels.Everything())
|
||||
allPods, err := rm.podLister.Pods(rc.Namespace).List(labels.Everything())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Ignore inactive pods.
|
||||
var filteredPods []*v1.Pod
|
||||
for _, pod := range pods {
|
||||
for _, pod := range allPods {
|
||||
if controller.IsPodActive(pod) {
|
||||
filteredPods = append(filteredPods, pod)
|
||||
}
|
||||
@@ -585,7 +585,7 @@ func (rm *ReplicationManager) syncReplicationController(key string) error {
|
||||
cm := controller.NewPodControllerRefManager(rm.podControl, rc, labels.Set(rc.Spec.Selector).AsSelectorPreValidated(), controllerKind)
|
||||
// NOTE: filteredPods are pointing to objects from cache - if you need to
|
||||
// modify them, you need to copy it first.
|
||||
filteredPods, err = cm.ClaimPods(pods)
|
||||
filteredPods, err = cm.ClaimPods(filteredPods)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user