Skip to content

Commit

Permalink
Merge pull request #2 from Vacant2333/feat-select-the-most-availalbe-…
Browse files Browse the repository at this point in the history
…ip-count-subnet

Feat select the most availalbe ip count subnet
  • Loading branch information
Summonair authored Jan 22, 2025
2 parents 7f160c7 + 390c0d6 commit 9ec2734
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/providers/subnet/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ func (p *DefaultProvider) ZonalSubnetsForLaunch(ctx context.Context, nodeClass *
if trackedIPs, ok := p.inflightIPs[subnet.ID]; ok {
prevIPs = trackedIPs
}

// Check if the remaining IP count is insufficient to meet the predicted IP usage;
// if so, remove this subnet zone record from inflightIPs and continue to the next item in the loop。
if prevIPs-predictedIPsUsed < 0 {
delete(zonalSubnets, subnet.Zone)
continue
}
p.inflightIPs[subnet.ID] = prevIPs - predictedIPsUsed
}
return zonalSubnets, nil
Expand Down

0 comments on commit 9ec2734

Please sign in to comment.