Skip to content

Commit fbb5adb

Browse files
authored
Merge pull request #626 from robscott/route-conflicts
Clarifying how conflicting matches should be resolved in non-HTTP Routes
2 parents efd0246 + 4891b54 commit fbb5adb

8 files changed

+172
-45
lines changed

apis/v1alpha1/httproute_types.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,8 @@ type RouteTLSConfig struct {
142142
// conditions, optionally executing additional processing steps, and forwarding
143143
// the request to an API object.
144144
type HTTPRouteRule struct {
145-
// Matches define conditions used for matching the rule against
146-
// incoming HTTP requests.
147-
// Each match is independent, i.e. this rule will be matched
145+
// Matches define conditions used for matching the rule against incoming
146+
// HTTP requests. Each match is independent, i.e. this rule will be matched
148147
// if **any** one of the matches is satisfied.
149148
//
150149
// For example, take the following matches configuration:
@@ -174,22 +173,27 @@ type HTTPRouteRule struct {
174173
// HTTP request.
175174
//
176175
//
177-
// A client request may match multiple HTTP route rules. Matching precedence
178-
// MUST be determined in order of the following criteria, continuing on ties:
176+
// Each client request MUST map to a maximum of one route rule. If a request
177+
// matches multiple rules, matching precedence MUST be determined in order
178+
// of the following criteria, continuing on ties:
179179
//
180180
// * The longest matching hostname.
181181
// * The longest matching path.
182182
// * The largest number of header matches.
183183
//
184-
// If ties still exist across multiple Routes:
184+
// If ties still exist across multiple Routes, matching precedence MUST be
185+
// determined in order of the following criteria, continuing on ties:
186+
//
185187
// * The oldest Route based on creation timestamp. For example, a Route with
186188
// a creation timestamp of "2020-09-08 01:02:03" is given precedence over
187189
// a Route with a creation timestamp of "2020-09-08 01:02:04".
188-
// * The Route appearing first in alphabetical order (namespace/name) for
189-
// example, foo/bar is given precedence over foo/baz.
190+
// * The Route appearing first in alphabetical order by
191+
// "<namespace>/<name>". For example, foo/bar is given precedence over
192+
// foo/baz.
190193
//
191-
// If ties still exist within the Route that has been given precedence:
192-
// * The first matching rule meeting the above criteria.
194+
// If ties still exist within the Route that has been given precedence,
195+
// matching precedence MUST be granted to the first matching rule meeting
196+
// the above criteria.
193197
//
194198
// +optional
195199
// +kubebuilder:validation:MaxItems=8

apis/v1alpha1/tcproute_types.go

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,32 @@ type TCPRouteStatus struct {
6060

6161
// TCPRouteRule is the configuration for a given rule.
6262
type TCPRouteRule struct {
63-
// Matches define conditions used for matching the rule against
64-
// incoming TCP connections. Each match is independent, i.e. this
65-
// rule will be matched if **any** one of the matches is satisfied.
66-
// If unspecified, all requests from the associated gateway TCP
67-
// listener will match.
63+
// Matches define conditions used for matching the rule against incoming TCP
64+
// connections. Each match is independent, i.e. this rule will be matched if
65+
// **any** one of the matches is satisfied. If unspecified (i.e. empty),
66+
// this Rule will match all requests for the associated Listener.
67+
//
68+
// Each client request MUST map to a maximum of one route rule. If a request
69+
// matches multiple rules, matching precedence MUST be determined in order
70+
// of the following criteria, continuing on ties:
71+
//
72+
// * The most specific match specified by ExtensionRef. Each implementation
73+
// that supports ExtensionRef may have different ways of determining the
74+
// specificity of the referenced extension.
75+
//
76+
// If ties still exist across multiple Routes, matching precedence MUST be
77+
// determined in order of the following criteria, continuing on ties:
78+
//
79+
// * The oldest Route based on creation timestamp. For example, a Route with
80+
// a creation timestamp of "2020-09-08 01:02:03" is given precedence over
81+
// a Route with a creation timestamp of "2020-09-08 01:02:04".
82+
// * The Route appearing first in alphabetical order by
83+
// "<namespace>/<name>". For example, foo/bar is given precedence over
84+
// foo/baz.
85+
//
86+
// If ties still exist within the Route that has been given precedence,
87+
// matching precedence MUST be granted to the first matching rule meeting
88+
// the above criteria.
6889
//
6990
// +optional
7091
// +kubebuilder:validation:MaxItems=8

apis/v1alpha1/tlsroute_types.go

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,35 @@ type TLSRouteStatus struct {
6565

6666
// TLSRouteRule is the configuration for a given rule.
6767
type TLSRouteRule struct {
68-
// Matches define conditions used for matching the rule against an
69-
// incoming TLS handshake. Each match is independent, i.e. this
70-
// rule will be matched if **any** one of the matches is satisfied.
71-
// If unspecified, all requests from the associated gateway TLS
72-
// listener will match.
68+
// Matches define conditions used for matching the rule against incoming TLS
69+
// connections. Each match is independent, i.e. this rule will be matched if
70+
// **any** one of the matches is satisfied. If unspecified (i.e. empty),
71+
// this Rule will match all requests for the associated Listener.
72+
//
73+
// Each client request MUST map to a maximum of one route rule. If a request
74+
// matches multiple rules, matching precedence MUST be determined in order
75+
// of the following criteria, continuing on ties:
76+
//
77+
// * The longest matching SNI.
78+
// * The longest matching precise SNI (without a wildcard). This means that
79+
// "b.example.com" should be given precedence over "*.example.com".
80+
// * The most specific match specified by ExtensionRef. Each implementation
81+
// that supports ExtensionRef may have different ways of determining the
82+
// specificity of the referenced extension.
83+
//
84+
// If ties still exist across multiple Routes, matching precedence MUST be
85+
// determined in order of the following criteria, continuing on ties:
86+
//
87+
// * The oldest Route based on creation timestamp. For example, a Route with
88+
// a creation timestamp of "2020-09-08 01:02:03" is given precedence over
89+
// a Route with a creation timestamp of "2020-09-08 01:02:04".
90+
// * The Route appearing first in alphabetical order by
91+
// "<namespace>/<name>". For example, foo/bar is given precedence over
92+
// foo/baz.
93+
//
94+
// If ties still exist within the Route that has been given precedence,
95+
// matching precedence MUST be granted to the first matching rule meeting
96+
// the above criteria.
7397
//
7498
// +optional
7599
// +kubebuilder:validation:MaxItems=8

apis/v1alpha1/udproute_types.go

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,32 @@ type UDPRouteStatus struct {
6060

6161
// UDPRouteRule is the configuration for a given rule.
6262
type UDPRouteRule struct {
63-
// Matches define conditions used for matching the rule against
64-
// incoming UDP connections. Each match is independent, i.e. this
65-
// rule will be matched if **any** one of the matches is satisfied.
66-
// If unspecified, all requests from the associated gateway UDP
67-
// listener will match.
63+
// Matches define conditions used for matching the rule against incoming UDP
64+
// connections. Each match is independent, i.e. this rule will be matched if
65+
// **any** one of the matches is satisfied. If unspecified (i.e. empty),
66+
// this Rule will match all requests for the associated Listener.
67+
//
68+
// Each client request MUST map to a maximum of one route rule. If a request
69+
// matches multiple rules, matching precedence MUST be determined in order
70+
// of the following criteria, continuing on ties:
71+
//
72+
// * The most specific match specified by ExtensionRef. Each implementation
73+
// that supports ExtensionRef may have different ways of determining the
74+
// specificity of the referenced extension.
75+
//
76+
// If ties still exist across multiple Routes, matching precedence MUST be
77+
// determined in order of the following criteria, continuing on ties:
78+
//
79+
// * The oldest Route based on creation timestamp. For example, a Route with
80+
// a creation timestamp of "2020-09-08 01:02:03" is given precedence over
81+
// a Route with a creation timestamp of "2020-09-08 01:02:04".
82+
// * The Route appearing first in alphabetical order by
83+
// "<namespace>/<name>". For example, foo/bar is given precedence over
84+
// foo/baz.
85+
//
86+
// If ties still exist within the Route that has been given precedence,
87+
// matching precedence MUST be granted to the first matching rule meeting
88+
// the above criteria.
6889
//
6990
// +optional
7091
// +kubebuilder:validation:MaxItems=8

config/crd/bases/networking.x-k8s.io_httproutes.yaml

Lines changed: 13 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/networking.x-k8s.io_tcproutes.yaml

Lines changed: 20 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/networking.x-k8s.io_tlsroutes.yaml

Lines changed: 24 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/networking.x-k8s.io_udproutes.yaml

Lines changed: 20 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)