Skip to content

[RHACS] Added docs for explanations feature #95065

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

Open
wants to merge 1 commit into
base: rhacs-docs-main
Choose a base branch
from

Conversation

gaurav-nelson
Copy link
Contributor

For https://issues.redhat.com/browse/ROX-29787

Added documentation for the new explainability feature.

Cherrypick in rhacs-docs-4.8.

Preview:

@gaurav-nelson gaurav-nelson added RHACS Label for RHACS related PRs that go in the rhacs-docs branch rhacs-docs-4.8 labels Jun 23, 2025
@openshift-ci openshift-ci bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 23, 2025
@ocpdocs-previewbot
Copy link

ocpdocs-previewbot commented Jun 23, 2025

@gaurav-nelson gaurav-nelson added the peer-review-needed Signifies that the peer review team needs to review this PR label Jun 23, 2025

:_mod-docs-content-type: PROCEDURE
[id="retrieving-explanations_{context}"]
= Retrieving explanations
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Can we simplify this word. Get or Fetch maybe?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can leave it as it is.

@gaurav-nelson gaurav-nelson removed the peer-review-needed Signifies that the peer review team needs to review this PR label Jun 23, 2025
Copy link

@adisos adisos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding comments for updating examples text and with links to actual YAML configurations.

@gaurav-nelson gaurav-nelson force-pushed the ROX-25000-np-guard-explainability branch from bc60026 to 8d264c0 Compare June 25, 2025 06:39
@gaurav-nelson gaurav-nelson added the peer-review-needed Signifies that the peer review team needs to review this PR label Jun 25, 2025
@gaurav-nelson gaurav-nelson requested a review from adisos June 25, 2025 06:44
Comment on lines +16 to +18
|`--explain`
|Enhance the analysis of permitted connectivity with explanations per denied/allowed connection; supported only for txt output format.

Copy link
Contributor Author

@gaurav-nelson gaurav-nelson Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: For peer review, please ignore this change. It is the actual output from the CLI tool.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question about this change:
why can't I see this update in the link for the table options here?

Also, why in this link the --exposure option exists, but not in the table of this changed file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @adisos this was an older file which we don't use anywhere. I've updated the correct file n my recent commit to fix it.

Copy link

@adisos adisos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, added one more question.

Comment on lines +16 to +18
|`--explain`
|Enhance the analysis of permitted connectivity with explanations per denied/allowed connection; supported only for txt output format.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question about this change:
why can't I see this update in the link for the table options here?

Also, why in this link the --exposure option exists, but not in the table of this changed file?

@agantony agantony added peer-review-in-progress Signifies that the peer review team is reviewing this PR and removed peer-review-needed Signifies that the peer review team needs to review this PR labels Jun 26, 2025
@gaurav-nelson gaurav-nelson force-pushed the ROX-25000-np-guard-explainability branch from 8d264c0 to 0698656 Compare June 26, 2025 11:44
Copy link
Contributor

@agantony agantony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlighted a few issues; overall lgtm!

@@ -49,3 +49,7 @@ Each line is composed of the following elements:
* `conn`:: Represents the permissible connectivity attributes.
An endpoint follows the format `namespace/name[Kind]`. For example, `default/backend[Deployment]`.

Additionally, you can also use the `--explain` option with the `roxctl netpol connectivity map` command to see which policies and rules are responsible for allowing or denying specific connections.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Additionally, you can also use the `--explain` option with the `roxctl netpol connectivity map` command to see which policies and rules are responsible for allowing or denying specific connections.
Opional: To see which policies and rules are responsible for allowing or denying specific connections, you can use the `--explain` option with the `roxctl netpol connectivity map` command.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -49,3 +49,7 @@ Each line is composed of the following elements:
* `conn`:: Represents the permissible connectivity attributes.
An endpoint follows the format `namespace/name[Kind]`. For example, `default/backend[Deployment]`.

Additionally, you can also use the `--explain` option with the `roxctl netpol connectivity map` command to see which policies and rules are responsible for allowing or denying specific connections.
The output is useful for debugging network policy configurations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The output is useful for debugging network policy configurations.
You can use the output to debug network policy configurations.


Additionally, you can also use the `--explain` option with the `roxctl netpol connectivity map` command to see which policies and rules are responsible for allowing or denying specific connections.
The output is useful for debugging network policy configurations.
For more information on understanding the explanation output, see "Retriving explanations" section.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For more information on understanding the explanation output, see "Retriving explanations" section.
For more information about understanding the explanation output, see "Retriving explanations".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


:_mod-docs-content-type: PROCEDURE
[id="retrieving-explanations_{context}"]
= Retrieving explanations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can leave it as it is.

= Retrieving explanations

[role="_abstract"]
Understand why connections are allowed or denied based on your Kubernetes network policy rules.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Understand why connections are allowed or denied based on your Kubernetes network policy rules.
You can understand why connections are allowed or denied based on your Kubernetes network policy rules by retrieving the explanations.

Comment on lines +46 to +48
In this example:

The connection from `monitoring/monitoring-service` to `internal-apps/internal-app-a` is allowed by the combination of ANP `pass-monitoring` that applies broadly on all namespaces with the label `security: internal` and a more specific NP `internal-apps/allow-monitoring` tailored for `internal-app-a`. The output shows that multiple policies can contribute to allowing a connection.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In this example:
The connection from `monitoring/monitoring-service` to `internal-apps/internal-app-a` is allowed by the combination of ANP `pass-monitoring` that applies broadly on all namespaces with the label `security: internal` and a more specific NP `internal-apps/allow-monitoring` tailored for `internal-app-a`. The output shows that multiple policies can contribute to allowing a connection.
In this example, the combination of ANP `pass-monitoring` allows the connection from `monitoring/monitoring-service` to `internal-apps/internal-app-a` that applies broadly on all namespaces with the label `security: internal` and a more specific NP `internal-apps/allow-monitoring` tailored for `internal-app-a`. The output shows that multiple policies can contribute to allowing a connection.

[discrete]
== Example blocked connections

Consider an isolated data service `isolated-data-service` which is designed to deny all external access by default for security reasons.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Consider an isolated data service `isolated-data-service` which is designed to deny all external access by default for security reasons.
Consider an isolated data service `isolated-data-service` which denies all external access by default for security reasons.


Consider an isolated data service `isolated-data-service` which is designed to deny all external access by default for security reasons.

You can see the YAML manifest for this example at link:https://github.com/np-guard/netpol-analyzer/tree/7ab6bbd421d3d80cbfff7cd1529ff8caf0137fbc/tests/anp_banp_explain_demo_2[`netpol-analyzer/tests/anp_banp_explain_demo_2/`].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No GitHub refs.


You can see the YAML manifest for this example at link:https://github.com/np-guard/netpol-analyzer/tree/7ab6bbd421d3d80cbfff7cd1529ff8caf0137fbc/tests/anp_banp_explain_demo_2[`netpol-analyzer/tests/anp_banp_explain_demo_2/`].

The explainability output for blocked connections from the `monitoring-service` deployment to this workload shows:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The explainability output for blocked connections from the `monitoring-service` deployment to this workload shows:
When you run the `roxctl netpol connectivity map --explain` command, you can see the following example explainability output for allowed connections from the `monitoring-service` deployment for such a configuration:

BaselineAdminNetworkPolicy 'default' denies connections by Ingress rule deny-ingress-from-monitoring
----

In this example, the connection to `data/isolated-data-service` is blocked by a combination of ANP with Pass action, and of BANP that denies all connections from `monitoring` by default.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In this example, the connection to `data/isolated-data-service` is blocked by a combination of ANP with Pass action, and of BANP that denies all connections from `monitoring` by default.
In this example, a combination of ANP with Pass action blocks the connection to `data/isolated-data-service`, and of BANP that denies all connections from `monitoring` by default.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ANP with Pass action does not block the connection, it only delegates the decision to the next policies layer, which in this case is the BANP. I would keep the original wording, that the combination of ANP with BANP results in a blocked connection for this case.

@agantony agantony added peer-review-done Signifies that the peer review team has reviewed this PR and removed peer-review-in-progress Signifies that the peer review team is reviewing this PR labels Jun 26, 2025
Copy link

openshift-ci bot commented Jun 26, 2025

@gaurav-nelson: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
peer-review-done Signifies that the peer review team has reviewed this PR RHACS Label for RHACS related PRs that go in the rhacs-docs branch rhacs-docs-4.8 size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants