Skip to content

Commit

Permalink
cni-server: do not perform ipv4 conflict detection during VM live mig…
Browse files Browse the repository at this point in the history
…ration (kubeovn#2693)
  • Loading branch information
zhangzujian committed Apr 24, 2023
1 parent 49dfd39 commit 22367be
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/daemon/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
u2oInterconnectionIP = podSubnet.Status.U2OInterconnectionIP
}

//skip ping check gateway for pods during live migration
detectIPConflict := podSubnet.Spec.Vlan != ""
// skip ping check gateway for pods during live migration
if pod.Annotations[fmt.Sprintf(util.LiveMigrationAnnotationTemplate, podRequest.Provider)] != "true" {
if podSubnet.Spec.Vlan != "" && !podSubnet.Spec.LogicalGateway {
if podSubnet.Spec.DisableGatewayCheck {
Expand All @@ -228,6 +229,9 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
gatewayCheckMode = gatewayCheckModePing
}
}
} else {
// do not perform ipv4 conflict detection during VM live migration
detectIPConflict = false
}

var mtu int
Expand Down Expand Up @@ -304,7 +308,6 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
}

klog.Infof("create container interface %s mac %s, ip %s, cidr %s, gw %s, u2o routes %v, custom routes %v", ifName, macAddr, ipAddr, cidr, gw, u2oRoutes, podRequest.Routes)
detectIPConflict := podSubnet.Spec.Vlan != ""
allRoutes := append(u2oRoutes, podRequest.Routes...)
if nicType == util.InternalType {
podNicName, err = csh.configureNicWithInternalPort(podRequest.PodName, podRequest.PodNamespace, podRequest.Provider, podRequest.NetNs, podRequest.ContainerID, ifName, macAddr, mtu, ipAddr, gw, isDefaultRoute, detectIPConflict, allRoutes, podRequest.DNS.Nameservers, podRequest.DNS.Search, ingress, egress, podRequest.DeviceID, nicType, latency, limit, loss, gatewayCheckMode, u2oInterconnectionIP)
Expand Down

0 comments on commit 22367be

Please sign in to comment.