Skip to content

Commit

Permalink
Default IPBatchSize to 1 (previous behavior) (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbernail authored Feb 7, 2020
1 parent 25af6fc commit 32c2302
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions aws/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,15 @@ func (c *interfaceClient) NewInterfaceOnSubnetAtIndex(index int, secGrps []strin
if err != nil {
return nil, err
}
ipv4Limit := limits.IPv4 - 1

// batch size 0 conventionally means "request the limit"
if ipBatchSize == 0 || ipBatchSize > ipv4Limit {
createReq.SecondaryPrivateIpAddressCount = &ipv4Limit
} else {
if ipBatchSize == 0 || ipBatchSize > limits.IPv4 {
ipBatchSize = limits.IPv4
}

// We will already get a primary IP on the ENI
ipBatchSize = ipBatchSize - 1
if ipBatchSize > 0 {
createReq.SecondaryPrivateIpAddressCount = &ipBatchSize
}

Expand Down
1 change: 1 addition & 0 deletions plugin/ipam/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func init() {
func parseConfig(stdin []byte) (*PluginConf, error) {
conf := PluginConf{
ReuseIPWait: 60, // default 60 second wait
IPBatchSize: 1, // default 1 (backward compatibility)
}

if err := json.Unmarshal(stdin, &conf); err != nil {
Expand Down

0 comments on commit 32c2302

Please sign in to comment.