Skip to content

Commit

Permalink
Merge pull request #739 from luoyunhe/bugfix
Browse files Browse the repository at this point in the history
【fix】get pod attachment net
  • Loading branch information
oilbeater authored Apr 9, 2021
2 parents 8e9789f + f9ae625 commit a6a0183
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,15 +782,19 @@ type kubeovnNet struct {
}

func (c *Controller) getPodAttachmentNet(pod *v1.Pod) ([]*kubeovnNet, error) {
var wholeAttachNets string
attachNetworks := pod.Annotations[util.AttachmentNetworkAnnotation]
var networkList []string

defaultAttachNetworks := pod.Annotations[util.DefaultNetworkAnnotation]
if defaultAttachNetworks != "" {
wholeAttachNets = defaultAttachNetworks
networkList = append(networkList, defaultAttachNetworks)
}

attachNetworks := pod.Annotations[util.AttachmentNetworkAnnotation]
if attachNetworks != "" {
wholeAttachNets = wholeAttachNets + "," + attachNetworks
networkList = append(networkList, attachNetworks)
}

wholeAttachNets := strings.Join(networkList, ",")
if wholeAttachNets == "" {
return nil, nil
}
Expand Down

0 comments on commit a6a0183

Please sign in to comment.