Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

refresh some checked fields in addPods #1137

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Next Next commit
refresh some checked fields in addPods
zapman449 committed Nov 14, 2019
commit 6555882275d6535029229fbb51b2a64f71b3ae4c
9 changes: 8 additions & 1 deletion pkg/rc/replication_controller.go
Original file line number Diff line number Diff line change
@@ -330,7 +330,14 @@ func (rc *replicationController) addPods(rcFields fields.RC, current types.PodLo
cancelFunc()
txn, cancelFunc = rc.newAuditingTransaction(context.Background(), rcFields, txn.Nodes())
}
if len(possibleSorted) < i+1 {

// since significant time may have passed since these values were instantiated,
// get updated values each iteration, and leverage those
tmpEligible, err := rc.eligibleNodes(rcFields)
// TODO: check err
tmpPossible := types.NewNodeSet(tmpEligible...).Difference(types.NewNodeSet(currentNodes...))
tmpPossibleSorted := tmpPossible.ListNodes()
if len(tmpPossibleSorted) < i+1 {
errMsg := fmt.Sprintf(
"Not enough nodes to meet desire: %d replicas desired, %d currentNodes, %d eligible. Scheduled on %d nodes instead.",
rcFields.ReplicasDesired, len(currentNodes), len(eligible), i,