Skip to content

Commit 5d787e2

Browse files
committed
ipam: use ip provided by nad annotation when providing IPAM for other CNI plugins (#4883)
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
1 parent 7981d08 commit 5d787e2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

pkg/controller/pod.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -1560,13 +1560,9 @@ func (c *Controller) getPodAttachmentNet(pod *v1.Pod) ([]*kubeovnNet, error) {
15601560
Subnet: subnet,
15611561
IsDefault: isDefault,
15621562
AllowLiveMigration: allowLiveMigration,
1563+
MacRequest: attach.MacRequest,
1564+
IPRequest: strings.Join(attach.IPRequest, ","),
15631565
}
1564-
1565-
if len(attach.IPRequest) != 0 {
1566-
ret.IPRequest = strings.Join(attach.IPRequest, ",")
1567-
}
1568-
1569-
ret.MacRequest = attach.MacRequest
15701566
result = append(result, ret)
15711567
} else {
15721568
providerName = fmt.Sprintf("%s.%s", attach.Name, attach.Namespace)
@@ -1576,6 +1572,8 @@ func (c *Controller) getPodAttachmentNet(pod *v1.Pod) ([]*kubeovnNet, error) {
15761572
Type: providerTypeIPAM,
15771573
ProviderName: providerName,
15781574
Subnet: subnet,
1575+
MacRequest: attach.MacRequest,
1576+
IPRequest: strings.Join(attach.IPRequest, ","),
15791577
})
15801578
break
15811579
}

0 commit comments

Comments
 (0)