Skip to content

Commit 966c31b

Browse files
committed
Some rewording of the priority conflict
- Assert that if multiple policies match, even though it is indeterminate which policy matches, only a single one will be applied. - This makes it more clear that admins should make different priorties for conflicts.
1 parent 7e5b3b1 commit 966c31b

File tree

3 files changed

+40
-28
lines changed

3 files changed

+40
-28
lines changed

apis/v1alpha1/adminnetworkpolicy_types.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,20 @@ type AdminNetworkPolicyStatus struct {
5656

5757
// AdminNetworkPolicySpec defines the desired state of AdminNetworkPolicy.
5858
type AdminNetworkPolicySpec struct {
59-
// Priority is a value from 0 to 1000. Policies with lower priority values have
60-
// higher precedence, and are checked before policies with higher priority values.
61-
// All AdminNetworkPolicy rules have higher precedence than NetworkPolicy or
62-
// BaselineAdminNetworkPolicy rules.
63-
// If two (or more) policies with the same priority could both match a connection,
64-
// then the implementation can apply any of the matching policies to the
65-
// connection, and there is no way for the user to reliably determine which one it
66-
// will choose. Administrators must be careful about assigning the priorities for
67-
// policies with rules that will match many connections, and ensure that policies
68-
// have unique priority values in cases where ambiguity would be unacceptable.
59+
// Priority is a value from 0 to 1000. Policies with lower
60+
// numeric priority values have higher precedence, and are
61+
// checked before policies with higher numeric priority
62+
// values. All AdminNetworkPolicy rules have higher precedence
63+
// than NetworkPolicy or BaselineAdminNetworkPolicy rules.
64+
//
65+
// If two (or more) policies with equal priority match the
66+
// same traffic, then any one (and only one) of the policies
67+
// will be applied to the traffic. There is no way for the
68+
// user to reliably determine which policy will be applied.
69+
//
70+
// Administrators should use different priorities numbers if
71+
// non-deterministic matching between overlapping policies is a
72+
// problem.
6973
//
7074
// +kubebuilder:validation:Minimum=0
7175
// +kubebuilder:validation:Maximum=1000

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -777,16 +777,20 @@ spec:
777777
type: array
778778
priority:
779779
description: |-
780-
Priority is a value from 0 to 1000. Policies with lower priority values have
781-
higher precedence, and are checked before policies with higher priority values.
782-
All AdminNetworkPolicy rules have higher precedence than NetworkPolicy or
780+
Priority is a value from 0 to 1000. Policies with lower numeric
781+
priority values have higher precedence, and are checked before
782+
policies with higher priority values. All AdminNetworkPolicy rules
783+
have higher precedence than NetworkPolicy or
783784
BaselineAdminNetworkPolicy rules.
784-
If two (or more) policies with the same priority could both match a connection,
785-
then the implementation can apply any of the matching policies to the
786-
connection, and there is no way for the user to reliably determine which one it
787-
will choose. Administrators must be careful about assigning the priorities for
788-
policies with rules that will match many connections, and ensure that policies
789-
have unique priority values in cases where ambiguity would be unacceptable.
785+
786+
If two (or more) policies with equal priority match the same
787+
traffic, then any one of the policies will be applied to the
788+
traffic. There is no way for the user to reliably determine the
789+
policy that will be applied.
790+
791+
Administrators should use different priorities numbers if
792+
non-deterministic matching between overlapping policies is a
793+
problem.
790794
format: int32
791795
maximum: 1000
792796
minimum: 0

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -667,16 +667,20 @@ spec:
667667
type: array
668668
priority:
669669
description: |-
670-
Priority is a value from 0 to 1000. Policies with lower priority values have
671-
higher precedence, and are checked before policies with higher priority values.
672-
All AdminNetworkPolicy rules have higher precedence than NetworkPolicy or
670+
Priority is a value from 0 to 1000. Policies with lower numeric
671+
priority values have higher precedence, and are checked before
672+
policies with higher priority values. All AdminNetworkPolicy rules
673+
have higher precedence than NetworkPolicy or
673674
BaselineAdminNetworkPolicy rules.
674-
If two (or more) policies with the same priority could both match a connection,
675-
then the implementation can apply any of the matching policies to the
676-
connection, and there is no way for the user to reliably determine which one it
677-
will choose. Administrators must be careful about assigning the priorities for
678-
policies with rules that will match many connections, and ensure that policies
679-
have unique priority values in cases where ambiguity would be unacceptable.
675+
676+
If two (or more) policies with equal priority match the same
677+
traffic, then any one of the policies will be applied to the
678+
traffic. There is no way for the user to reliably determine the
679+
policy that will be applied.
680+
681+
Administrators should use different priorities numbers if
682+
non-deterministic matching between overlapping policies is a
683+
problem.
680684
format: int32
681685
maximum: 1000
682686
minimum: 0

0 commit comments

Comments
 (0)