Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't modify maxENI #472

Merged
merged 1 commit into from
May 16, 2019
Merged
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
19 changes: 2 additions & 17 deletions ipamd/ipamd.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,6 @@ type IPAMContext struct {

currentMaxAddrsPerENI int
maxAddrsPerENI int
// maxENI indicate the maximum number of ENIs can be attached to the instance
// It is initialized to 0 and it is set to current number of ENIs attached
// when ipamd receives AttachmentLimitExceeded error
maxENI int
primaryIP map[string]string
lastNodeIPPoolAction time.Time
lastDecreaseIPPool time.Time
Expand Down Expand Up @@ -590,13 +586,8 @@ func (c *IPAMContext) increaseIPPool() {
}

if c.dataStore.GetENIs() < maxENIs {
// c.maxENI represent the discovered maximum number of ENIs
if (c.maxENI > 0) && (c.maxENI == c.dataStore.GetENIs()) {
mogren marked this conversation as resolved.
Show resolved Hide resolved
log.Debugf("Skipping ENI allocation due to max ENI already attached to the instance: %d", c.maxENI)
} else {
c.tryAllocateENI()
c.updateLastNodeIPPoolAction()
}
c.tryAllocateENI()
c.updateLastNodeIPPoolAction()
} else {
log.Debugf("Skipping ENI allocation due to max ENI already attached to the instance: %d", maxENIs)
}
Expand Down Expand Up @@ -640,12 +631,6 @@ func (c *IPAMContext) tryAllocateENI() {
eni, err := c.awsClient.AllocENI(customNetworkCfg, securityGroups, subnet)
if err != nil {
log.Errorf("Failed to increase pool size due to not able to allocate ENI %v", err)

if isAttachmentLimitExceededError(err) {
c.maxENI = c.dataStore.GetENIs()
log.Infof("Discovered the instance max ENI allowed is: %d", c.maxENI)
}
// TODO need to add health stats
ipamdErrInc("increaseIPPoolAllocENI", err)
return
}
Expand Down