Skip to content

Commit 3dc5c3f

Browse files
committed
fix(NPC): remove HostNetwork check from OnPodUpdate
With the previous logic, if a pod changed from having HostNetwork = False to HostNetwork = True, NPC would not trigger a refresh to clear out the rules that once applied. Now this check has been moved lower in the fullPolicySync() logic so that it accounts for these pods naturally.
1 parent 13e0a39 commit 3dc5c3f

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

pkg/controllers/netpol/pod.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ func (npc *NetworkPolicyController) newPodEventHandler() cache.ResourceEventHand
3636
// OnPodUpdate handles updates to pods from the Kubernetes api server
3737
func (npc *NetworkPolicyController) OnPodUpdate(obj interface{}) {
3838
pod := obj.(*api.Pod)
39-
if pod.Spec.HostNetwork {
40-
klog.V(2).Infof("Ignoring update to hostNetwork pod: %s/%s", pod.Namespace, pod.Name)
41-
return
42-
}
4339
klog.V(2).Infof("Received update to pod: %s/%s", pod.Namespace, pod.Name)
4440

4541
npc.RequestFullSync()

0 commit comments

Comments
 (0)