Skip to content

Commit

Permalink
cni: add mtu in add result (#3922)
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian authored Apr 16, 2024
1 parent 8cc1a0f commit 1d69328
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/cni/cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func generateCNIResult(cniResponse *request.CniResponse, netns string) current.R
podIface := current.Interface{
Name: cniResponse.PodNicName,
Mac: cniResponse.MacAddress,
Mtu: cniResponse.Mtu,
Sandbox: netns,
}
switch cniResponse.Protocol {
Expand Down
3 changes: 2 additions & 1 deletion pkg/daemon/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
return
}

var mtu int
routes = append(podRequest.Routes, routes...)
if strings.HasSuffix(podRequest.Provider, util.OvnProvider) && subnet != "" {
podSubnet, err := csh.Controller.subnetsLister.Get(subnet)
Expand Down Expand Up @@ -270,7 +271,6 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
detectIPConflict = false
}

var mtu int
if podSubnet.Spec.Mtu > 0 {
mtu = int(podSubnet.Spec.Mtu)
} else {
Expand Down Expand Up @@ -368,6 +368,7 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
CIDR: cidr,
PodNicName: podNicName,
Routes: routes,
Mtu: mtu,
}
if isDefaultRoute {
response.Gateway = gw
Expand Down

0 comments on commit 1d69328

Please sign in to comment.