Skip to content
Merged
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
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ require (
github.com/petar/GoLLRB v0.0.0-20190514000832-33fb24c13b99 // indirect
github.com/prometheus/client_golang v1.0.0
github.com/prometheus/client_model v0.2.0
github.com/satori/go.uuid v1.2.0 // indirect
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.3.2
Expand All @@ -31,7 +30,6 @@ require (
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
google.golang.org/appengine v1.6.5 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
k8s.io/api v0.18.2
k8s.io/apimachinery v0.18.2
k8s.io/client-go v0.18.2
Expand Down
3 changes: 3 additions & 0 deletions ipam/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ func (s *azureSource) refresh() error {
continue
}

addressCount := 0
// For each address in the subnet...
for _, a := range s.IPAddress {
// Primary addresses are reserved for the host.
Expand All @@ -172,7 +173,9 @@ func (s *azureSource) refresh() error {
log.Printf("[ipam] Failed to create address:%v err:%v.", address, err)
continue
}
addressCount++
}
log.Printf("[ipam] got %d addresses from interface %s, subnet %s", addressCount, ifName, subnet)
}
}

Expand Down
13 changes: 7 additions & 6 deletions ipam/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,24 +474,22 @@ func (ap *addressPool) newAddressRecord(addr *net.IP) (*addressRecord, error) {
func (ap *addressPool) requestAddress(address string, options map[string]string) (string, error) {
var ar *addressRecord
var addr *net.IPNet
var err error
id := options[OptAddressID]

log.Printf("[ipam] Requesting address with address:%v options:%+v.", address, options)
defer func() { log.Printf("[ipam] Address request completed with address:%v err:%v.", addr, err) }()

if address != "" {
// Return the specific address requested.
ar = ap.Addresses[address]
if ar == nil {
err = errAddressNotFound
return "", err
log.Printf("[ipam] Address request failed with %v", errAddressNotFound)
return "", errAddressNotFound
}
if ar.InUse {
// Return the same address if IDs match.
if id == "" || id != ar.ID {
err = errAddressInUse
return "", err
log.Printf("[ipam] Address request failed with %v", errAddressInUse)
return "", errAddressInUse
}
}
} else if options[OptAddressType] == OptAddressTypeGateway {
Expand All @@ -515,6 +513,7 @@ func (ap *addressPool) requestAddress(address string, options map[string]string)
}

if ar == nil {
log.Printf("[ipam] Address request failed with %v", errNoAvailableAddresses)
return "", errNoAvailableAddresses
}
}
Expand All @@ -532,6 +531,8 @@ func (ap *addressPool) requestAddress(address string, options map[string]string)
Mask: ap.Subnet.Mask,
}

log.Printf("[ipam] Address request completed with address:%v", addr)

return addr.String(), nil
}

Expand Down