Skip to content

Commit

Permalink
network: pod IPs should be stored in a cache file for binding plugin
Browse files Browse the repository at this point in the history
Otherwise, the status of the VMI will contain only the GA IPs.

This fix was done because of a bug discovered in passt binding plugin
tests.
In passt the guest IP6 is not the same as the pod one (in case the guest
has not DHCPv6 client).
The fact that the pod IPv6 wasn't cached, caused the internal GA IPv6 to
be in the VMI status.

Signed-off-by: Alona Paz <[email protected]>
  • Loading branch information
AlonaKaplan committed Jan 8, 2024
1 parent fe8f3f8 commit 2322ad1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 0 additions & 1 deletion pkg/network/setup/netconf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ var _ = Describe("netconf", func() {
Expect(netConf.Setup(vmi, vmi.Spec.Networks, launcherPid, netPreSetupDummyNoop)).To(Succeed())
Expect(stateCache.stateCache).To(BeEmpty())
},
Entry("binding", v1.InterfaceBindingMethod{}),
Entry("SR-IOV", v1.InterfaceBindingMethod{SRIOV: &v1.InterfaceSRIOV{}}),
Entry("macvtap", v1.InterfaceBindingMethod{Macvtap: &v1.InterfaceMacvtap{}}),
)
Expand Down
9 changes: 8 additions & 1 deletion pkg/network/setup/netpod/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,15 @@ func (n NetPod) discover(currentStatus *nmstate.Status) error {
return err
}

// Skip the discovery for all other known network interface bindings.
case vmiSpecIface.Binding != nil:
// The existence of the pod interface depends on the network binding plugin implementation
if podIfaceExists {
if err := n.storePodInterfaceData(vmiSpecIface, podIfaceStatus); err != nil {
return err
}
}

// Skip the discovery for all other known network interface bindings.
case vmiSpecIface.Macvtap != nil:
case vmiSpecIface.SRIOV != nil:
default:
Expand Down
2 changes: 1 addition & 1 deletion pkg/network/setup/netpod/netpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ func filterSupportedBindingNetworks(specNetworks []v1.Network, specInterfaces []
return nil, fmt.Errorf("no iface matching with network %s", network.Name)
}

if iface.Binding != nil || iface.SRIOV != nil || iface.Macvtap != nil {
if iface.SRIOV != nil || iface.Macvtap != nil {
continue
}

Expand Down

0 comments on commit 2322ad1

Please sign in to comment.