Skip to content

Commit d158588

Browse files
committed
Address PR review comments from danwinship.
- Reword Accept action text per reviewer suggestion - Replace "gress" with "each rule" in api-overview - Fix formatting of "at the minimum", field references - Document that Networks peer matches ICMP/ICMPv6 traffic Prepared with the assistance of Claude Code.
1 parent 34ce4bb commit d158588

4 files changed

Lines changed: 44 additions & 30 deletions

File tree

apis/v1alpha2/clusternetworkpolicy_types.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ type ClusterNetworkPolicyIngressRule struct {
190190
// Action specifies the effect this rule will have on matching
191191
// traffic. Currently, the following actions are supported:
192192
//
193-
// - Accept: Accepts the selected traffic, and ensures that response
194-
// traffic including "related" ICMP traffic is also allowed. No further
195-
// ingress ClusterNetworkPolicy or NetworkPolicy rules will be processed.
193+
// - Accept: Accepts the selected traffic, including replies to that
194+
// traffic and related ICMP traffic. No further ingress
195+
// ClusterNetworkPolicy or NetworkPolicy rules will be processed.
196196
//
197197
// Note: while Accept ensures traffic is accepted by
198198
// Kubernetes network policy, it is still possible that the
@@ -245,11 +245,11 @@ type ClusterNetworkPolicyEgressRule struct {
245245
Name string `json:"name,omitempty"`
246246

247247
// Action specifies the effect this rule will have on matching
248-
// traffic. Currently the following actions are supported:
248+
// traffic. Currently, the following actions are supported:
249249
//
250-
// - Accept: Accepts the selected traffic, and ensures that response
251-
// traffic including "related" ICMP traffic is also allowed. No further
252-
// egress ClusterNetworkPolicy or NetworkPolicy rules will be processed
250+
// - Accept: Accepts the selected traffic, including replies to that
251+
// traffic and related ICMP traffic. No further egress
252+
// ClusterNetworkPolicy or NetworkPolicy rules will be processed
253253
// but any ingress rules at the destination do apply.
254254
//
255255
// - Deny: Drops the selected traffic. No further ClusterNetworkPolicy or
@@ -376,6 +376,11 @@ type ClusterNetworkPolicyEgressPeer struct {
376376
// or deny all IPv4 pod-to-pod traffic as well. If you don't want that,
377377
// add a rule that Passes all pod traffic before the Networks rule.
378378
//
379+
// Networks matches both regular IP traffic and ICMP traffic to/from
380+
// the specified CIDRs. For example, a Networks entry of "0.0.0.0/0"
381+
// will match both IPv4 and ICMP traffic, while "0::/0" will match
382+
// both IPv6 and ICMPv6 traffic.
383+
//
379384
// Each item in Networks should be provided in the CIDR format and should be
380385
// IPv4 or IPv6, for example "10.0.0.0/8" or "fd00::/8".
381386
//

config/crd/experimental/policy.networking.k8s.io_clusternetworkpolicies.yaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ spec:
7575
action:
7676
description: |-
7777
Action specifies the effect this rule will have on matching
78-
traffic. Currently the following actions are supported:
78+
traffic. Currently, the following actions are supported:
7979
80-
- Accept: Accepts the selected traffic, and ensures that response
81-
traffic including "related" ICMP traffic is also allowed. No further
82-
egress ClusterNetworkPolicy or NetworkPolicy rules will be processed
80+
- Accept: Accepts the selected traffic, including replies to that
81+
traffic and related ICMP traffic. No further egress
82+
ClusterNetworkPolicy or NetworkPolicy rules will be processed
8383
but any ingress rules at the destination do apply.
8484
8585
- Deny: Drops the selected traffic. No further ClusterNetworkPolicy or
@@ -373,6 +373,11 @@ spec:
373373
or deny all IPv4 pod-to-pod traffic as well. If you don't want that,
374374
add a rule that Passes all pod traffic before the Networks rule.
375375
376+
Networks matches both regular IP traffic and ICMP traffic to/from
377+
the specified CIDRs. For example, a Networks entry of "0.0.0.0/0"
378+
will match both IPv4 and ICMP traffic, while "0::/0" will match
379+
both IPv6 and ICMPv6 traffic.
380+
376381
Each item in Networks should be provided in the CIDR format and should be
377382
IPv4 or IPv6, for example "10.0.0.0/8" or "fd00::/8".
378383
@@ -590,9 +595,9 @@ spec:
590595
Action specifies the effect this rule will have on matching
591596
traffic. Currently, the following actions are supported:
592597
593-
- Accept: Accepts the selected traffic, and ensures that response
594-
traffic including "related" ICMP traffic is also allowed. No further
595-
ingress ClusterNetworkPolicy or NetworkPolicy rules will be processed.
598+
- Accept: Accepts the selected traffic, including replies to that
599+
traffic and related ICMP traffic. No further ingress
600+
ClusterNetworkPolicy or NetworkPolicy rules will be processed.
596601
597602
Note: while Accept ensures traffic is accepted by
598603
Kubernetes network policy, it is still possible that the

config/crd/standard/policy.networking.k8s.io_clusternetworkpolicies.yaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ spec:
7575
action:
7676
description: |-
7777
Action specifies the effect this rule will have on matching
78-
traffic. Currently the following actions are supported:
78+
traffic. Currently, the following actions are supported:
7979
80-
- Accept: Accepts the selected traffic, and ensures that response
81-
traffic including "related" ICMP traffic is also allowed. No further
82-
egress ClusterNetworkPolicy or NetworkPolicy rules will be processed
80+
- Accept: Accepts the selected traffic, including replies to that
81+
traffic and related ICMP traffic. No further egress
82+
ClusterNetworkPolicy or NetworkPolicy rules will be processed
8383
but any ingress rules at the destination do apply.
8484
8585
- Deny: Drops the selected traffic. No further ClusterNetworkPolicy or
@@ -335,6 +335,11 @@ spec:
335335
or deny all IPv4 pod-to-pod traffic as well. If you don't want that,
336336
add a rule that Passes all pod traffic before the Networks rule.
337337
338+
Networks matches both regular IP traffic and ICMP traffic to/from
339+
the specified CIDRs. For example, a Networks entry of "0.0.0.0/0"
340+
will match both IPv4 and ICMP traffic, while "0::/0" will match
341+
both IPv6 and ICMPv6 traffic.
342+
338343
Each item in Networks should be provided in the CIDR format and should be
339344
IPv4 or IPv6, for example "10.0.0.0/8" or "fd00::/8".
340345
@@ -492,9 +497,9 @@ spec:
492497
Action specifies the effect this rule will have on matching
493498
traffic. Currently, the following actions are supported:
494499
495-
- Accept: Accepts the selected traffic, and ensures that response
496-
traffic including "related" ICMP traffic is also allowed. No further
497-
ingress ClusterNetworkPolicy or NetworkPolicy rules will be processed.
500+
- Accept: Accepts the selected traffic, including replies to that
501+
traffic and related ICMP traffic. No further ingress
502+
ClusterNetworkPolicy or NetworkPolicy rules will be processed.
498503
499504
Note: while Accept ensures traffic is accepted by
500505
Kubernetes network policy, it is still possible that the

site-src/api-overview.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,10 @@ traffic, ClusterNetworkPolicy will enable administrators to set `Pass`,
7878
be read as-is, i.e. there will not be any implicit isolation effects for the Pods
7979
selected by the ClusterNetworkPolicy, as opposed to implicit deny NetworkPolicy rules imply.
8080

81-
- **Accept**: Accepts the selected traffic, and ensures that
82-
response traffic including "related" ICMP traffic (e.g. ICMP
83-
errors such as "destination unreachable" or "packet too big")
84-
is also allowed. No further ClusterNetworkPolicy or
85-
NetworkPolicy rules will be processed.
81+
- **Accept**: Accepts the selected traffic, including replies to that
82+
traffic and related ICMP traffic (e.g. ICMP errors such as
83+
"destination unreachable" or "packet too big"). No further
84+
ClusterNetworkPolicy or NetworkPolicy rules will be processed.
8685

8786
- **Deny**: Drops the selected traffic. No further
8887
ClusterNetworkPolicy or NetworkPolicy rules will be
@@ -121,10 +120,10 @@ before policies with higher priority values in the same tier.
121120
### Rules
122121

123122
Each CNP should define at least one `Ingress` or `Egress` relevant in-cluster traffic flow
124-
along with the associated Action that should occur. In each `gress` rule the user
125-
should AT THE MINIMUM define an `Action`, and at least one `ClusterNetworkPolicyPeer`.
126-
Optionally the user may also define select `Protocols` to filter traffic on and also
127-
a name for each rule to make management and reporting easier for Admins.
123+
along with the associated Action that should occur. In each rule the user
124+
should *at the minimum* define an `Action`, and at least one peer (`To` or `From` entry).
125+
Optionally the user may also select `Protocols` to filter traffic on and also
126+
a `Name` for each rule to make management and reporting easier for Admins.
128127

129128
The `Protocols` field supports protocol-specific matching for TCP, UDP, and SCTP
130129
(including destination port numbers, port ranges, and named ports).

0 commit comments

Comments
 (0)