Skip to content

Commit

Permalink
ip-reconciler: Add all non default interfaces to Pod IP list
Browse files Browse the repository at this point in the history
  • Loading branch information
xagent003 committed Sep 21, 2021
1 parent 3dacc67 commit 4b33f0d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
7 changes: 3 additions & 4 deletions pkg/reconciler/wrappedPod.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ func getFlatIPSet(pod v1.Pod) map[string]void {
continue
}

if network.Interface[:multusPrefixSize] == multusInterfaceNamePrefix {
for _, ip := range network.IPs {
ipSet[ip] = empty
}
for _, ip := range network.IPs {
ipSet[ip] = empty
logging.Debugf("Added IP %s for pod %s", ip, composePodRef(pod))
}
}
return ipSet
Expand Down
17 changes: 0 additions & 17 deletions pkg/reconciler/wrappedPod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,6 @@ var _ = Describe("Pod Wrapper operations", func() {
Expect(podSecondaryIPs).To(Equal(map[string]void{"192.168.14.14": {}, "10.10.10.10": {}}))
})

It("should filter out non-multus annotations", func() {
secondaryIfacesNetworkStatuses := generateMultusNetworkStatusList("192.168.14.14", "10.10.10.10")

networkStatus := append(
secondaryIfacesNetworkStatuses,
generateMultusNetworkStatus("eth0", "network33", "14.15.16.20"))
pod := v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Annotations: generateMultusNetworkStatusAnnotationFromNetworkStatus(networkStatus...),
},
}

podSecondaryIPs := wrapPod(pod).ips
Expect(podSecondaryIPs).To(HaveLen(2))
Expect(podSecondaryIPs).To(Equal(map[string]void{"192.168.14.14": {}, "10.10.10.10": {}}))
})

It("return an empty list when the network annotations of a pod are invalid", func() {
pod := v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Expand Down

0 comments on commit 4b33f0d

Please sign in to comment.