diff --git a/pkg/backend/vxlan/vxlan_network.go b/pkg/backend/vxlan/vxlan_network.go index d00d41c718..e697b2a8fc 100644 --- a/pkg/backend/vxlan/vxlan_network.go +++ b/pkg/backend/vxlan/vxlan_network.go @@ -97,6 +97,7 @@ func (nw *network) handleSubnetEvents(batch []lease.Event) { sn := event.Lease.Subnet v6Sn := event.Lease.IPv6Subnet attrs := event.Lease.Attrs + log.Infof("Received Subnet Event with VxLan: %s", attrs.String()) if attrs.BackendType != "vxlan" { log.Warningf("ignoring non-vxlan v4Subnet(%s) v6Subnet(%s): type=%v", sn, v6Sn, attrs.BackendType) continue diff --git a/pkg/lease/lease.go b/pkg/lease/lease.go index c7503eaf6f..6d4c1eb0dc 100644 --- a/pkg/lease/lease.go +++ b/pkg/lease/lease.go @@ -15,7 +15,9 @@ package lease import ( + "bytes" "encoding/json" + "fmt" "time" "github.com/flannel-io/flannel/pkg/ip" @@ -71,6 +73,35 @@ type LeaseWatcher struct { Leases []Lease //Leases with subnets from other nodes } +func (la *LeaseAttrs) String() string { + var buffer bytes.Buffer + buffer.WriteString(fmt.Sprintf("BackendType: %s, PublicIP: %s, ", la.BackendType, la.PublicIP.String())) + if la.PublicIPv6 != nil { + buffer.WriteString(fmt.Sprintf("PublicIPv6: %s, ", la.PublicIPv6.String())) + } else { + buffer.WriteString("PublicIPv6: (nil), ") + } + if la.BackendData != nil { + j, err := json.Marshal(la.BackendData) + if err != nil { + buffer.WriteString("BackendData: (nil), ") + } + buffer.WriteString(fmt.Sprintf("BackendData: %s, ", string(j))) + } else { + buffer.WriteString("BackendData: (nil), ") + } + if la.BackendV6Data != nil { + j, err := json.Marshal(la.BackendV6Data) + if err != nil { + buffer.WriteString("BackendV6Data: (nil)") + } + buffer.WriteString(fmt.Sprintf("BackendV6Data: %s", string(j))) + } else { + buffer.WriteString("BackendV6Data: (nil)") + } + return buffer.String() +} + // Reset is called by etcd-subnet when using a snapshot func (lw *LeaseWatcher) Reset(leases []Lease) []Event { batch := []Event{}