Skip to content

Commit

Permalink
use multus-cni as default cni to assign ip
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhen-ma committed Dec 28, 2021
1 parent 3205b88 commit a03a858
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cmd/cni/cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func cmdAdd(args *skel.CmdArgs) error {
if err != nil {
return err
}
if args.IfName == "eth0" {
if netConf.Provider == "" && netConf.Type == util.CniTypeName && args.IfName == "eth0" {
netConf.Provider = util.OvnProvider
}

Expand Down Expand Up @@ -126,7 +126,7 @@ func cmdDel(args *skel.CmdArgs) error {
if err != nil {
return err
}
if args.IfName == "eth0" {
if netConf.Type == util.CniTypeName && args.IfName == "eth0" {
netConf.Provider = util.OvnProvider
}

Expand Down
9 changes: 3 additions & 6 deletions pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -967,13 +967,10 @@ func (c *Controller) getPodAttachmentNet(pod *v1.Pod) ([]*kubeovnNet, error) {
var providerName string
if util.IsOvnNetwork(netCfg) {
isDefault := util.IsDefaultNet(pod.Annotations[util.DefaultNetworkAnnotation], attach)
if isDefault {
providerName = util.OvnProvider
} else {
providerName = fmt.Sprintf("%s.%s.ovn", attach.Name, attach.Namespace)
}
providerName = fmt.Sprintf("%s.%s.ovn", attach.Name, attach.Namespace)

subnetName := pod.Annotations[fmt.Sprintf(util.LogicalSwitchAnnotationTemplate, providerName)]
if !isDefault && subnetName == "" {
if subnetName == "" {
for _, subnet := range subnets {
if subnet.Spec.Provider == providerName {
subnetName = subnet.Name
Expand Down

0 comments on commit a03a858

Please sign in to comment.