network, bridge: mutating the struct should happen on `discover`
This way, the only requirement we have when calling the
`generateDomainIface` method, is that it needs to be executed
*after* the `discoverPodInterface` method.
@@ -415,6 +415,7 @@ func (b *BridgeBindMechanism) discoverPodNetworkInterface() error {
}
}
+ b.tapDeviceName = generateTapDeviceName(b.podInterfaceName)
if b.podNicLink.Attrs().MTU < 0 || b.podNicLink.Attrs().MTU > 65535 {
return fmt.Errorf("MTU value out of range ")
}
@@ -480,8 +481,6 @@ func (b *BridgeBindMechanism) preparePodNetworkInterface() error {
return err
}
- b.tapDeviceName = generateTapDeviceName(b.podInterfaceName)
-
if b.ipamEnabled {
// Remove IP from POD interface
err := b.handler.AddrDel(b.podNicLink, &b.podIfaceIP)
