Skip to content

Commit

Permalink
ip-control-loop: strip pod before queueing it
Browse files Browse the repository at this point in the history
The ip reconcile loop only requires the pod metadata and its network
status annotatations to garbage collect the stale IP addresses.

As such, we remove the status and spec parameters from the pod before
queueing it.

Signed-off-by: Miguel Duarte Barroso <[email protected]>
  • Loading branch information
maiqueb committed Mar 11, 2022
1 parent 90835cd commit 0a68cab
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/reconciler/controlloop/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func onPodDelete(queue workqueue.RateLimitingInterface, obj interface{}) {
}

logging.Verbosef("deleted pod [%s]", podID(pod.GetNamespace(), pod.GetName()))
queue.Add(pod)
queue.Add(stripPod(pod)) // we only need the pod's metadata & its network-status annotations. Hence we strip it.
}

func podID(podNamespace string, podName string) string {
Expand Down Expand Up @@ -348,3 +348,10 @@ func podFromTombstone(obj interface{}) (*v1.Pod, error) {
}
return pod, nil
}

func stripPod(pod *v1.Pod) *v1.Pod {
newPod := pod.DeepCopy()
newPod.Spec = v1.PodSpec{}
newPod.Status = v1.PodStatus{}
return newPod
}

0 comments on commit 0a68cab

Please sign in to comment.