Skip to content

Commit

Permalink
add nicType for offload
Browse files Browse the repository at this point in the history
  • Loading branch information
fanriming committed Jun 10, 2021
1 parent 70ac93b commit aa88e2a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pkg/daemon/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
vlanID = pod.Annotations[fmt.Sprintf(util.VlanIdAnnotationTemplate, podRequest.Provider)]
ipAddr = util.GetIpAddrWithMask(ip, cidr)
ifName = podRequest.IfName
nicType = pod.Annotations[util.PodNicAnnotation]
if podRequest.DeviceID != "" {
nicType = util.OffloadType
} else {
nicType = pod.Annotations[util.PodNicAnnotation]
}
netns = podRequest.NetNs
break
}
Expand Down Expand Up @@ -266,7 +270,12 @@ func (csh cniServerHandler) handleDel(req *restful.Request, resp *restful.Respon
}
}

nicType := pod.Annotations[util.PodNicAnnotation]
var nicType string
if podRequest.DeviceID != "" {
nicType = util.OffloadType
} else {
nicType = pod.Annotations[util.PodNicAnnotation]
}
err = csh.deleteNic(podRequest.PodName, podRequest.PodNamespace, podRequest.ContainerID, podRequest.DeviceID, podRequest.IfName, nicType)
if err != nil {
errMsg := fmt.Errorf("del nic failed %v", err)
Expand Down
1 change: 1 addition & 0 deletions pkg/util/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const (

PodNicAnnotation = "ovn.kubernetes.io/pod_nic_type"
VethType = "veth-pair"
OffloadType = "offload-port"
InternalType = "internal-port"

ChassisLoc = "/etc/openvswitch/system-id.conf"
Expand Down

0 comments on commit aa88e2a

Please sign in to comment.