Skip to content

Commit

Permalink
fix(NPC): remove HostNetwork check from OnPodUpdate
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aauren committed May 25, 2021
1 parent 81d52c2 commit 8520865
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions pkg/controllers/netpol/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ func (npc *NetworkPolicyController) newPodEventHandler() cache.ResourceEventHand
// OnPodUpdate handles updates to pods from the Kubernetes api server
func (npc *NetworkPolicyController) OnPodUpdate(obj interface{}) {
pod := obj.(*api.Pod)
if pod.Spec.HostNetwork {
klog.V(2).Infof("Ignoring update to hostNetwork pod: %s/%s", pod.Namespace, pod.Name)
return
}
klog.V(2).Infof("Received update to pod: %s/%s", pod.Namespace, pod.Name)

npc.RequestFullSync()
Expand Down

0 comments on commit 8520865

Please sign in to comment.