File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ package controller
3
3
import (
4
4
"encoding/json"
5
5
"fmt"
6
- "reflect"
7
6
"strings"
8
7
"time"
9
8
@@ -192,7 +191,7 @@ func (pnc *PodNetworksController) handlePodUpdate(oldObj interface{}, newObj int
192
191
remove DynamicAttachmentRequestType = "remove"
193
192
)
194
193
195
- if reflect . DeepEqual (oldPod . Annotations , newPod . Annotations ) {
194
+ if ! didNetworkSelectionElementsChange (oldPod , newPod ) {
196
195
return
197
196
}
198
197
podNamespace := oldPod .GetNamespace ()
@@ -473,3 +472,14 @@ func serializeNetAttachDefWithDefaults(netAttachDef *nadv1.NetworkAttachmentDefi
473
472
}
474
473
return netAttachDefWithDefaults , nil
475
474
}
475
+
476
+ func didNetworkSelectionElementsChange (oldPod * corev1.Pod , newPod * corev1.Pod ) bool {
477
+ oldNetworkSelectionElementsString , didPodHaveExtraAttachments := oldPod .Annotations [nadv1 .NetworkAttachmentAnnot ]
478
+ newNetworkSelectionElementsString , doesPodHaveExtraAttachmentsNow := newPod .Annotations [nadv1 .NetworkAttachmentAnnot ]
479
+
480
+ if didPodHaveExtraAttachments != doesPodHaveExtraAttachmentsNow ||
481
+ oldNetworkSelectionElementsString != newNetworkSelectionElementsString {
482
+ return true
483
+ }
484
+ return false
485
+ }
You can’t perform that action at this time.
0 commit comments