@@ -177,10 +177,9 @@ func (c *Controller) handleUpdateNp(key string) error {
177177 return err
178178 }
179179
180+ enforcementLax := c .isNetworkPolicyEnforcementLax (np )
180181 if hasIngressRule (np ) {
181182 if protocolSet .Size () > 0 {
182- enforcementLax := c .isNetworkPolicyEnforcementLax (np )
183-
184183 blockACLOps , err := c .OVNNbClient .UpdateDefaultBlockACLOps (key , pgName , ovnnb .ACLDirectionToLport , logEnable , enforcementLax )
185184 if err != nil {
186185 klog .Errorf ("failed to set default ingress block acl: %v" , err )
@@ -328,8 +327,6 @@ func (c *Controller) handleUpdateNp(key string) error {
328327
329328 if hasEgressRule (np ) {
330329 if protocolSet .Size () > 0 {
331- enforcementLax := c .isNetworkPolicyEnforcementLax (np )
332-
333330 blockACLOps , err := c .OVNNbClient .UpdateDefaultBlockACLOps (key , pgName , ovnnb .ACLDirectionFromLport , logEnable , enforcementLax )
334331 if err != nil {
335332 klog .Errorf ("failed to set default egress block acl: %v" , err )
@@ -470,10 +467,12 @@ func (c *Controller) handleUpdateNp(key string) error {
470467 }
471468 }
472469
473- for _ , subnet := range subnets {
474- if err = c .OVNNbClient .CreateGatewayACL ("" , pgName , subnet .Spec .Gateway , subnet .Status .U2OInterconnectionIP ); err != nil {
475- klog .Errorf ("create gateway acl: %v" , err )
476- return err
470+ if ! enforcementLax {
471+ for _ , subnet := range subnets {
472+ if err = c .OVNNbClient .CreateGatewayACL ("" , pgName , subnet .Spec .Gateway , subnet .Status .U2OInterconnectionIP ); err != nil {
473+ klog .Errorf ("create gateway acl: %v" , err )
474+ return err
475+ }
477476 }
478477 }
479478 return nil
0 commit comments