Skip to content

Commit

Permalink
Better handling explainability data for system default
Browse files Browse the repository at this point in the history
  • Loading branch information
tanyaveksler committed Nov 11, 2024
1 parent 9c0ab85 commit feca3a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/netpol/eval/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ func (pe *PolicyEngine) getXgressDefaultConns(src, dst k8s.Peer, isIngress bool)
}
if res.IsEmpty() { // banp rules didn't capture xgress conn between src and dst, return system-default: allow-all
res.AllowedConns = common.MakeConnectionSet(true)
res.AllowedConns.AddCommonImplyingRule(systemDefaultRule, isIngress)
}
return res, nil
}
5 changes: 3 additions & 2 deletions pkg/netpol/eval/internal/k8s/policy_connections.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ func (pc *PolicyConnections) CollectConnsFromBANP(banpConns *PolicyConnections)
// Pass Conns which are allowed or not captured by BANP, will be handled now with all other conns.
// pc.PassConns is not relevant anymore.
// the allowed conns are "all conns - the denied conns"
// since all conns that are not determined by the ANP and BANP are allowed by default
pc.AllowedConns = common.MakeConnectionSet(true)
// all conns that are not determined by the ANP and BANP are allowed by default,
// and are kept in banpConns.AllowedConns (were returned by getXgressDefaultConns)
pc.AllowedConns = banpConns.AllowedConns
pc.AllowedConns.Subtract(pc.DeniedConns)
}

Expand Down

0 comments on commit feca3a3

Please sign in to comment.