Skip to content
This repository was archived by the owner on Apr 29, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pkg/rc/replication_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,15 @@ func (rc *replicationController) addPods(rcFields fields.RC, current types.PodLo
cancelFunc()
txn, cancelFunc = rc.newAuditingTransaction(context.Background(), rcFields, txn.Nodes())
}

// since significant time may have passed since these values were instantiated,
// get updated values each iteration, and leverage those
eligible, err := rc.eligibleNodes(rcFields)
if err != nil {
return err
}
possible = types.NewNodeSet(eligible...).Difference(types.NewNodeSet(currentNodes...))
possibleSorted = possible.ListNodes()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we repeating lines 300 and 304 here?

if len(possibleSorted) < i+1 {
errMsg := fmt.Sprintf(
"Not enough nodes to meet desire: %d replicas desired, %d currentNodes, %d eligible. Scheduled on %d nodes instead.",
Expand All @@ -353,7 +362,7 @@ func (rc *replicationController) addPods(rcFields fields.RC, current types.PodLo
}
scheduleOn := possibleSorted[i]

err := rc.schedule(txn, rcFields, scheduleOn)
err = rc.schedule(txn, rcFields, scheduleOn)
if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions pkg/rc/replication_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,7 @@ func TestAddPods(t *testing.T) {
ID: rc.rcID,
ReplicasDesired: 5,
Manifest: testManifest(),
NodeSelector: klabels.Everything().Add("nodeQuality", klabels.EqualsOperator, []string{"good"}),
}

// empty
Expand Down