Skip to content

Commit

Permalink
Change service interface to macvlan when using DHCP
Browse files Browse the repository at this point in the history
When using DHCP for LB services, the resulting IP was assigned to the
`serviceInterface` while most (not all) DHCP communication was done
through a per-service `macvlan` interface that is created on demand.

This has been the cause of DHCP lease renewal failures for some users,
as the response packets from the server never reached kube-vip. For more
details, see issue #871.

To remedy this, the primary interface used for a service is now being
set to the `macvlan`. Consequently, the IP address is also assigned to
it.

As a result, all traffic related to an LB service (DHCP or not) is now
originating from and sent to the per-service `macvlan` interface that
is tied to the user-configured `serviceInterface`.

Fixes #871

Signed-off-by: Til Blechschmidt <me@tibl.dev>
  • Loading branch information
TilBlechschmidt committed Jul 19, 2024
1 parent a571d0a commit a0a19ea
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/manager/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,12 @@ func NewInstance(svc *v1.Service, config *kubevip.Config) (*Instance, error) {
return nil, fmt.Errorf("error starting DHCP for %s/%s: error: %s",
instance.serviceSnapshot.Namespace, instance.serviceSnapshot.Name, err)
case ip := <-instance.dhcpClient.IPChannel():
instance.vipConfigs[0].Interface = instance.dhcpInterface
instance.vipConfigs[0].VIP = ip
instance.dhcpInterfaceIP = ip
}
}

for _, vipConfig := range instance.vipConfigs {
c, err := cluster.InitCluster(vipConfig, false)
if err != nil {
Expand Down

0 comments on commit a0a19ea

Please sign in to comment.