Skip to content

Commit 03c4233

Browse files
kubevirt-botqinqon
andauthored
pod-pool: skip if pod has no multus network (#554)
At some environments with a lot of pods the initial pod looping takes a lot of time and 99% of pods has no multus network, this change move the pod without multus networks check at the beginning of the loop since that check is cheapr than checking opt out or opt in, so it renders the loop faster. Signed-off-by: Enrique Llorente <ellorent@redhat.com> Co-authored-by: Enrique Llorente <ellorent@redhat.com>
1 parent 47931a1 commit 03c4233

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pkg/pool-manager/pod_pool.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,20 +228,21 @@ func (p *PoolManager) initPodMap() error {
228228
err := p.paginatePodsWithLimit(100, func(pods *corev1.PodList) error {
229229
for _, pod := range pods.Items {
230230
log.V(1).Info("InitMaps for pod", "podName", pod.Name, "podNamespace", pod.Namespace)
231-
instanceManaged, err := p.IsPodManaged(pod.GetNamespace())
232-
if err != nil {
231+
if pod.Annotations == nil {
233232
continue
234233
}
235-
if !instanceManaged {
234+
235+
networkValue, ok := pod.Annotations[networkv1.NetworkAttachmentAnnot]
236+
if !ok {
236237
continue
237238
}
238239

239-
if pod.Annotations == nil {
240+
instanceManaged, err := p.IsPodManaged(pod.GetNamespace())
241+
if err != nil {
240242
continue
241243
}
242244

243-
networkValue, ok := pod.Annotations[networkv1.NetworkAttachmentAnnot]
244-
if !ok {
245+
if !instanceManaged {
245246
continue
246247
}
247248

0 commit comments

Comments
 (0)