Skip to content

API docs: clarify ICMP related.#364

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
fasaxc:improve-icmp-docs
Apr 22, 2026
Merged

API docs: clarify ICMP related.#364
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
fasaxc:improve-icmp-docs

Conversation

@fasaxc
Copy link
Copy Markdown
Contributor

@fasaxc fasaxc commented Mar 31, 2026

Clarify that ICMP related packets (such as TOOBIG) are included when accepting traffic. Tighten up action descriptions and improve formatting in various places.

PR generated with assistance of AI (Claude).

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 31, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 31, 2026

Deploy Preview for kubernetes-sigs-network-policy-api ready!

Name Link
🔨 Latest commit cadb73e
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-network-policy-api/deploys/69e88e5bdde88f00086dff9c
😎 Deploy Preview https://deploy-preview-364--kubernetes-sigs-network-policy-api.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

@danwinship danwinship left a comment

Choose a reason for hiding this comment

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

Should mention that the Networks peer selects both IP/IPv4 and ICMP/ICMPv6 traffic too.

// the destination. No further ClusterNetworkPolicy or
// NetworkPolicy rules will be processed.
// - Accept: Accepts the selected traffic, and ensures that response
// traffic including "related" ICMP traffic is also allowed. No further
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd at least put a comma before "including", but maybe "Accepts the selected traffic, including replies to that traffic and related ICMP traffic." (and likewise in the other places with the same text).

Comment thread site-src/api-overview.md Outdated
Each CNP should define at least one `Ingress` or `Egress` relevant in-cluster traffic flow
along with the associated Action that should occur. In each `gress` rule the user
Each CNP should define at least one `Ingress` or `Egress` relevant in-cluster traffic flow
along with the associated Action that should occur. In each `gress` rule the user
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think there's an issue about getting rid of the non-word "gress" everywhere, so let's start here. You can just drop it entirely and say "each rule".

Comment thread site-src/api-overview.md Outdated
along with the associated Action that should occur. In each `gress` rule the user
Each CNP should define at least one `Ingress` or `Egress` relevant in-cluster traffic flow
along with the associated Action that should occur. In each `gress` rule the user
should AT THE MINIMUM define an `Action`, and at least one `ClusterNetworkPolicyPeer`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
should AT THE MINIMUM define an `Action`, and at least one `ClusterNetworkPolicyPeer`.
should *at the minimum* define an `Action`, and at least one peer (`To` or `From` entry).

Comment thread site-src/api-overview.md
along with the associated Action that should occur. In each `gress` rule the user
should AT THE MINIMUM define an `Action`, and at least one `ClusterNetworkPolicyPeer`.
Optionally the user may also define select `Ports` to filter traffic on and also
Optionally the user may also define select `Protocols` to filter traffic on and also
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Optionally the user may also define select `Protocols` to filter traffic on and also
Optionally the user may also select `Protocols` to filter traffic on and also

Comment thread site-src/api-overview.md
should AT THE MINIMUM define an `Action`, and at least one `ClusterNetworkPolicyPeer`.
Optionally the user may also define select `Ports` to filter traffic on and also
Optionally the user may also define select `Protocols` to filter traffic on and also
a name for each rule to make management and reporting easier for Admins.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
a name for each rule to make management and reporting easier for Admins.
a `Name` for each rule to make management and reporting easier for Admins.

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Apr 2, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: fasaxc / name: Shaun Crampton (cadb73e)

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 2, 2026
@fasaxc fasaxc force-pushed the improve-icmp-docs branch from 4538b54 to d158588 Compare April 2, 2026 10:19
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Apr 2, 2026
Copy link
Copy Markdown
Contributor

@tssurya tssurya left a comment

Choose a reason for hiding this comment

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

can't tell why the CI is red https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/kubernetes-sigs_network-policy-api/364/pull-network-policy-api-verify/2039649007680098304
very weird "Test started last Thursday at 12:19 PM failed after 49h42m18s."

// - Accept: Accepts the selected traffic, allowing it into
// the destination. No further ClusterNetworkPolicy or
// NetworkPolicy rules will be processed.
// - Accept: Accepts the selected traffic, including replies to that
Copy link
Copy Markdown
Contributor

@tssurya tssurya Apr 5, 2026

Choose a reason for hiding this comment

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

We spoke a bit about this during AMS KubeCon,
but a note for future that since we have made this explicit we do need to consider this while designing the ICMP protocol match whether ICMP protocol match will also allow related or if its purely restricted to specific independent types and codes.
just highlighting it for history (no action required from this comment)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There's some trickiness here, but I would hope that conntrack deals with it all for us.

If you allow ICMP pings, you would also have implicitly be allowing the replies to that ping, just like in the IP case.

// ClusterNetworkPolicyRuleActionAccept indicates that
// matching traffic will be accepted and no further policy
// evaluation will be done. This is a final decision.
// ClusterNetworkPolicyRuleActionAccept stops further rule processing of
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hmm interesting..I am trying to find the nuance/motivation behind the change here and for the other actions..
so ACCEPT in ingress rules being hit doesn't mean the policy stops being evaluated but we still evaluate the egress rules?
OR
is there something between policy v/s rules?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Traffic from pod A to pod B goes through pod A's egress rules and pod B's ingress rules. The change was intended to hint that pod A's "egress accept" may still get blocked by pod B's ingress rules.

TBH I started just trying to make the language more direct. "stops and accepts" instead of "indicates that ..."

// - Deny: Drops the selected traffic. No further
// ClusterNetworkPolicy or NetworkPolicy rules will be
// processed.
// - Deny: Drops the selected traffic. No further ClusterNetworkPolicy or
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I recently learnt that networkpolicies when created mid way do expect to effect existing connections? so for both DENY and PASS it actually does include ICMP related as well for that connection?

Copy link
Copy Markdown
Contributor

@danwinship danwinship Apr 6, 2026

Choose a reason for hiding this comment

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

For networkingv1.NetworkPolicy there is no official expectation about what happens when you create a NetworkPolicy that matches a pre-existing connection. For CNP we're leaning toward "it breaks existing connections" but we never finished that discussion (#305).

Comment thread site-src/api-overview.md Outdated
Each CNP should define at least one `Ingress` or `Egress` relevant in-cluster traffic flow
along with the associated Action that should occur. In each rule the user
should *at the minimum* define an `Action`, and at least one peer (`To` or `From` entry).
Optionally the user may also select `Protocols` to filter traffic on and also
Copy link
Copy Markdown
Contributor

@tssurya tssurya Apr 5, 2026

Choose a reason for hiding this comment

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

I would remove this from this PR since https://github.com/kubernetes-sigs/network-policy-api/pull/363/changes#diff-a6c5effcce61a6f6fa4724456fa5ef6c7cf5d72306dce662570e1429c6776e3dR124 there is an earlier PR here that is doing that change so I can review that separately..the changes to the first part To and From makes sense
I don't want to leave the other contributor hanging (sweat smiley)

//
// Networks matches both regular IP traffic and ICMP traffic to/from
// the specified CIDRs. For example, a Networks entry of "0.0.0.0/0"
// will match both IPv4 and ICMP traffic, while "0::/0" will match
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"::/0"

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 8, 2026
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 20, 2026
@fasaxc fasaxc force-pushed the improve-icmp-docs branch from 082cea5 to 2a1070f Compare April 20, 2026 14:58
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 20, 2026
@danwinship
Copy link
Copy Markdown
Contributor

lgtm, but needs a rebase

@danwinship
Copy link
Copy Markdown
Contributor

and can you squash the fixup commits?

@fasaxc fasaxc force-pushed the improve-icmp-docs branch from 2a1070f to ee67a7d Compare April 21, 2026 14:17
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 21, 2026
@fasaxc
Copy link
Copy Markdown
Contributor Author

fasaxc commented Apr 21, 2026

Done

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 22, 2026
Note that ICMP related packets (such as TOOBIG) are allowed
when allowing the main protocol connection.

Improve wording in various places.
@fasaxc fasaxc force-pushed the improve-icmp-docs branch from ee67a7d to cadb73e Compare April 22, 2026 09:01
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 22, 2026
Copy link
Copy Markdown
Contributor

@tssurya tssurya left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 22, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fasaxc, tssurya

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 22, 2026
@k8s-ci-robot k8s-ci-robot merged commit 1c9af17 into kubernetes-sigs:main Apr 22, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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