@@ -137,10 +137,9 @@ func (npMgr *NetworkPolicyManager) UpdateNetworkPolicy(oldNpObj *networkingv1.Ne
137137// DeleteNetworkPolicy handles deleting network policy from iptables.
138138func (npMgr * NetworkPolicyManager ) DeleteNetworkPolicy (npObj * networkingv1.NetworkPolicy ) error {
139139 var (
140- err error
141- ns * namespace
142- allNs = npMgr .nsMap [util .KubeAllNamespacesFlag ]
143- ipsMgr = allNs .ipsMgr
140+ err error
141+ ns * namespace
142+ allNs = npMgr .nsMap [util .KubeAllNamespacesFlag ]
144143 )
145144
146145 npNs , npName := "ns-" + npObj .ObjectMeta .Namespace , npObj .ObjectMeta .Name
@@ -155,7 +154,7 @@ func (npMgr *NetworkPolicyManager) DeleteNetworkPolicy(npObj *networkingv1.Netwo
155154 npMgr .nsMap [npNs ] = ns
156155 }
157156
158- sets , namedPorts , lists , iptEntries := translatePolicy (npObj )
157+ _ , _ , _ , iptEntries := translatePolicy (npObj )
159158
160159 iptMgr := allNs .iptMgr
161160 for _ , iptEntry := range iptEntries {
@@ -166,16 +165,6 @@ func (npMgr *NetworkPolicyManager) DeleteNetworkPolicy(npObj *networkingv1.Netwo
166165
167166 delete (ns .rawNpMap , npObj .ObjectMeta .Name )
168167
169- for _ , set := range sets {
170- ipsMgr .DeleteSet (set )
171- }
172- for _ , set := range namedPorts {
173- ipsMgr .DeleteSet (set )
174- }
175- for _ , list := range lists {
176- ipsMgr .DeleteList (list )
177- }
178-
179168 hashedSelector := HashSelector (& npObj .Spec .PodSelector )
180169 if oldPolicy , oldPolicyExists := ns .processedNpMap [hashedSelector ]; oldPolicyExists {
181170 deductedPolicy , err := deductPolicy (oldPolicy , npObj )
0 commit comments