Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explainability #459

Merged
merged 72 commits into from
Feb 16, 2025
Merged
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
4684411
explainability
tanyaveksler Dec 10, 2024
8217a4b
More delicate handling of intersection of ingress and egress connecti…
tanyaveksler Dec 10, 2024
1e7cbb9
make linter happy
tanyaveksler Dec 23, 2024
faa7ad7
Merge branch 'main' into explainability_new_clean
tanyaveksler Dec 23, 2024
181b9ac
fixing lint errors
tanyaveksler Dec 23, 2024
67ef886
Merge branch 'main' into explainability_new_clean
tanyaveksler Dec 23, 2024
d50485b
More delicate handlinng of IPblock default connections explanation;
tanyaveksler Dec 23, 2024
cd17f64
More compact explainability print
tanyaveksler Jan 6, 2025
326a88e
Fixed lint error
tanyaveksler Jan 6, 2025
4395e77
Merge branch 'main' into explainability_new_clean
tanyaveksler Jan 6, 2025
929c75d
More compact explanation printing.
tanyaveksler Jan 6, 2025
ffe247c
Added more explainability tests.
tanyaveksler Jan 6, 2025
520ef12
Added more explainability tests.
tanyaveksler Jan 7, 2025
9c947f6
Merge branch 'main' into explainability_new_clean
tanyaveksler Jan 7, 2025
409629a
Added a comment
tanyaveksler Jan 7, 2025
48ceb56
Sorting together explanations for specific ports and for all ports in…
tanyaveksler Jan 7, 2025
4686e3e
Added more tests
tanyaveksler Jan 7, 2025
710077a
Added more delicate collect/override implying rules mechanism (consid…
tanyaveksler Jan 13, 2025
49050df
Make linter happy
tanyaveksler Jan 13, 2025
d78e3c4
Changed explanation output for empty Xgress rules;
tanyaveksler Jan 14, 2025
4ab3d96
make linter happy;
tanyaveksler Jan 14, 2025
2f52f7b
make linter happy
tanyaveksler Jan 14, 2025
76c3876
Merge branch 'main' into explainability_new_clean
tanyaveksler Jan 14, 2025
ae74452
changed names of pods in anp_banp_blog_demo test
tanyaveksler Jan 14, 2025
3385cb1
Changed named of pods in anp_banp_blog_demo_2 (according to the chang…
tanyaveksler Jan 14, 2025
2a86aeb
Merge branch 'main' into explainability_new_clean
tanyaveksler Jan 20, 2025
718b34d
Changed default IP block conections explanation to be the same as sys…
tanyaveksler Jan 20, 2025
44f6c94
Added explanability option documtation to REAME
tanyaveksler Jan 20, 2025
2328c54
Removed unused functions / code.
tanyaveksler Jan 20, 2025
8cb665d
Small change in explanability formatting; changed expected results ac…
tanyaveksler Jan 21, 2025
00c229b
Another change in explanation output formatting and in the expected o…
tanyaveksler Jan 21, 2025
3057057
Make linter happy.
tanyaveksler Jan 27, 2025
006dc26
Merge branch 'main' into explainability_new_clean
tanyaveksler Jan 27, 2025
78bf5fe
Added more tests.
tanyaveksler Jan 27, 2025
ac7f587
Fixed explanation handling for ingress controller.
tanyaveksler Jan 27, 2025
5a35d3c
Merge branch 'main' into explainability_new_clean;
tanyaveksler Feb 4, 2025
dd1cfbb
fixing linter errors.
tanyaveksler Feb 4, 2025
5894002
fixing linter errors.
tanyaveksler Feb 4, 2025
b0ed51c
Merge branch 'explainability_new_clean' of github.com:np-guard/netpol…
tanyaveksler Feb 4, 2025
c262857
Merge branch 'main' into explainability_new_clean
tanyaveksler Feb 4, 2025
88d34db
Avoid running explainability analysis and exposure analysis together
tanyaveksler Feb 4, 2025
c656c2c
make linter happy
tanyaveksler Feb 4, 2025
04fe5ed
Fixed ingress resources handling: collecting all ingress implying rul…
tanyaveksler Feb 4, 2025
7db86b6
Fixed collection explainability rules in Union of ConnectionSets - mo…
tanyaveksler Feb 10, 2025
7116922
Merge branch 'main' into explainability_new_clean
tanyaveksler Feb 10, 2025
91255e4
make linter happy
tanyaveksler Feb 10, 2025
66aed97
Reorganized and simplified categories in explainability output to imp…
tanyaveksler Feb 10, 2025
ef3eab0
More readable formatting of explainability output.
tanyaveksler Feb 11, 2025
782a212
More output format changes.
tanyaveksler Feb 11, 2025
65a24e8
Merge branch 'main' into explainability_new_clean
tanyaveksler Feb 11, 2025
9a938f9
Removed rule numbering. Instead, organizing rules by layers, and sort…
tanyaveksler Feb 11, 2025
76d95ae
make linter happy.
tanyaveksler Feb 11, 2025
8453eaa
update .gitignore
adisos Feb 12, 2025
9b4437b
tiny change in output
shireenf-ibm Feb 13, 2025
f796234
Merge branch 'main' into explainability_new_clean
shireenf-ibm Feb 13, 2025
f83ed64
lint fix
shireenf-ibm Feb 13, 2025
707a73b
changing LIST to list
shireenf-ibm Feb 13, 2025
68cdf79
update explain_analysis.md
adisos Feb 13, 2025
cc5f954
changes in outputs + update explain_analysis.md
shireenf-ibm Feb 13, 2025
fbb5f6b
running make test-update removes empty lines on top of files
shireenf-ibm Feb 13, 2025
e652c38
adding warning when running --explain with unsupported format
shireenf-ibm Feb 13, 2025
b30d395
ignore explain value for not supported formats
shireenf-ibm Feb 13, 2025
a32750d
fix lint errors
shireenf-ibm Feb 13, 2025
ff2df49
update example test
adisos Feb 13, 2025
8f15cd3
fix: remove connlist No conns lines from unsupported formats when run…
shireenf-ibm Feb 13, 2025
bb60efa
Merge branch 'explainability_new_clean' of github.com:np-guard/netpol…
shireenf-ibm Feb 13, 2025
49808ad
`list` support explain flag with exposure flag (#503)
shireenf-ibm Feb 13, 2025
81aa3b2
remove unused OnlyCommonRules() and unexport OnlyDefaultRule()
adisos Feb 13, 2025
6a9a9c2
unexport Explanation field in singleConnFields
adisos Feb 13, 2025
f196e42
revert changes to a deprecated func
shireenf-ibm Feb 13, 2025
bbef37f
replace "list" with "connections" - explain output
shireenf-ibm Feb 16, 2025
ec654e0
updating explain output - np rules explain
shireenf-ibm Feb 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Sorting together explanations for specific ports and for all ports in…
… a protocol
  • Loading branch information
tanyaveksler committed Jan 7, 2025
commit 48ceb56d55d9054e624f883ca7f1b7f91c0d2c45
6 changes: 3 additions & 3 deletions pkg/netpol/internal/common/connectionset.go
Original file line number Diff line number Diff line change
@@ -480,7 +480,7 @@ type InSetAndRulesStr struct {
rulesString string
}

func portsStringWithExplanation(ports []PortRange, protocolString string) string {
func portsStringWithExplanation(ports []PortRange, protocolString string) []string {
// for compact explanation: collect together ranges with the same 'inSet' and impying rules
portRangeClasses := map[InSetAndRulesStr]*interval.CanonicalSet{}
for i := range ports {
@@ -500,7 +500,7 @@ func portsStringWithExplanation(ports []PortRange, protocolString string) string
ind++
}
sort.Strings(portsStr)
return strings.Join(portsStr, NewLine)
return portsStr
}

func protocolAndPortsStr(protocol v1.Protocol, ports string) string {
@@ -537,7 +537,7 @@ func ExplanationFromConnProperties(allProtocolsAndPorts bool, commonImplyingRule
continue
}
}
connStrings = append(connStrings, portsStringWithExplanation(ports, string(protocol)))
connStrings = append(connStrings, portsStringWithExplanation(ports, string(protocol))...)
}
if len(wholeRangeProtocols) > 0 {
sort.Strings(wholeRangeProtocols)
4 changes: 2 additions & 2 deletions test_outputs/connlist/anp_banp_blog_demo_2_explain_output.txt
Original file line number Diff line number Diff line change
@@ -32,6 +32,8 @@ ALLOWED TCP:[1234] due to the following policies//rules:

ALLOWED TCP:[9001-65535] the system default (Allow all)

ALLOWED {SCTP,UDP}:[ALL PORTS] the system default (Allow all)

DENIED TCP:[1-1233,1235-8079,8081-9000] due to the following policies//rules:
EGRESS DIRECTION (ALLOWED) due to the system default (Allow all)
INGRESS DIRECTION (DENIED)
@@ -43,8 +45,6 @@ DENIED TCP:[8080] due to the following policies//rules:
1) [ANP] pass-monitoring//Ingress rule pass-ingress-from-monitoring (Pass)
2) [BANP] default//Ingress rule deny-ingress-from-all-namespaces (Deny)

ALLOWED {SCTP,UDP}:[ALL PORTS] the system default (Allow all)

----------------------------------------------------------------------------------------------------------------------------------------------------------------
CONNECTIONS BETWEEN monitoring/my-monitoring[Pod] => baz/my-baz[Pod]:

4 changes: 2 additions & 2 deletions test_outputs/connlist/anp_test_10_explain_output.txt
Original file line number Diff line number Diff line change
@@ -29,13 +29,13 @@ CONNECTIONS BETWEEN network-policy-conformance-hufflepuff/cedric-diggory[Statefu

ALLOWED UDP:[1-5352,5354-65535] the system default (Allow all)

ALLOWED {SCTP,TCP}:[ALL PORTS] the system default (Allow all)

DENIED UDP:[5353] due to the following policies//rules:
EGRESS DIRECTION (DENIED)
1) [ANP] egress-udp//Egress rule deny-to-slytherin-at-port-5353 (Deny)
INGRESS DIRECTION (ALLOWED) due to the system default (Allow all)

ALLOWED {SCTP,TCP}:[ALL PORTS] the system default (Allow all)

----------------------------------------------------------------------------------------------------------------------------------------------------------------
The following nodes are connected due to the system default or the assumed default for IPblock (Allow all):
0.0.0.0-255.255.255.255 => network-policy-conformance-gryffindor/harry-potter[StatefulSet]
Loading
Oops, something went wrong.