diff --git a/go.mod b/go.mod index bc704d7f3e..9c4c674eb7 100644 --- a/go.mod +++ b/go.mod @@ -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 @@ -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 diff --git a/ipam/azure.go b/ipam/azure.go index aed4bc9934..1a0c742136 100644 --- a/ipam/azure.go +++ b/ipam/azure.go @@ -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. @@ -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) } } diff --git a/ipam/pool.go b/ipam/pool.go index 45e664a585..71272ed335 100644 --- a/ipam/pool.go +++ b/ipam/pool.go @@ -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 { @@ -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 } } @@ -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 }