Skip to content

Commit

Permalink
implement GEP-820: remove extension points from route match types
Browse files Browse the repository at this point in the history
  • Loading branch information
hbagdi committed Aug 25, 2021
1 parent 8343da8 commit 59bc62c
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 369 deletions.
11 changes: 0 additions & 11 deletions apis/v1alpha2/httproute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,17 +453,6 @@ type HTTPRouteMatch struct {
//
// +optional
Method *HTTPMethod `json:"method,omitempty"`

// ExtensionRef is an optional, implementation-specific extension to the
// "match" behavior. For example, resource "myroutematcher" in group
// "networking.example.net". If the referent cannot be found, the rule is
// not included in the route. The controller must ensure the "ResolvedRefs"
// condition on the Route status is set to `status: False`.
//
// Support: Custom
//
// +optional
ExtensionRef *LocalObjectReference `json:"extensionRef,omitempty"`
}

// HTTPRouteFilter defines additional processing steps that must be completed
Expand Down
49 changes: 10 additions & 39 deletions apis/v1alpha2/tcproute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,35 +57,15 @@ type TCPRouteStatus struct {

// TCPRouteRule is the configuration for a given rule.
type TCPRouteRule struct {
// Matches define conditions used for matching the rule against incoming TCP
// connections. Each match is independent, i.e. this rule will be matched if
// **any** one of the matches is satisfied. If unspecified (i.e. empty),
// this Rule will match all requests for the associated Listener.
//
// Each client request MUST map to a maximum of one route rule. If a request
// matches multiple rules, matching precedence MUST be determined in order
// of the following criteria, continuing on ties:
//
// * The most specific match specified by ExtensionRef. Each implementation
// that supports ExtensionRef may have different ways of determining the
// specificity of the referenced extension.
//
// If ties still exist across multiple Routes, matching precedence MUST be
// determined in order of the following criteria, continuing on ties:
//
// * The oldest Route based on creation timestamp. For example, a Route with
// a creation timestamp of "2020-09-08 01:02:03" is given precedence over
// a Route with a creation timestamp of "2020-09-08 01:02:04".
// * The Route appearing first in alphabetical order by
// "<namespace>/<name>". For example, foo/bar is given precedence over
// foo/baz.
//
// If ties still exist within the Route that has been given precedence,
// matching precedence MUST be granted to the first matching rule meeting
// the above criteria.
// Matches define conditions used for matching the rule against incoming UDP
// connections. No matching criteria exists currently but MAY be added in
// future. This implies that it is not possible to define match semantics
// within this resource and that any given listener on the Gateway MUST
// match a single Route resource and a single rule within the Route
// resource.
//
// +optional
// +kubebuilder:validation:MaxItems=8
// +kubebuilder:validation:MaxItems=0
Matches []TCPRouteMatch `json:"matches,omitempty"`

// BackendRefs defines the backend(s) where matching requests should be
Expand All @@ -105,19 +85,10 @@ type TCPRouteRule struct {
BackendRefs []BackendRef `json:"backendRefs,omitempty"`
}

// TCPRouteMatch defines the predicate used to match connections to a
// given action.
// TCPRouteMatch defines the predicate used to match TCP connections to a
// given backend. No matching criteria exists currently but MAY be added
// in future.
type TCPRouteMatch struct {
// ExtensionRef is an optional, implementation-specific extension to the
// "match" behavior. For example, resource "mytcproutematcher" in group
// "networking.example.net". If the referent cannot be found, the rule MUST
// not be included in the route. The controller must ensure the
// "ResolvedRefs" condition on the Route status is set to `status: False`.
//
// Support: Custom
//
// +optional
ExtensionRef *LocalObjectReference `json:"extensionRef,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
51 changes: 9 additions & 42 deletions apis/v1alpha2/tlsroute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,38 +90,15 @@ type TLSRouteStatus struct {

// TLSRouteRule is the configuration for a given rule.
type TLSRouteRule struct {
// Matches define conditions used for matching the rule against incoming TLS
// connections. Each match is independent, i.e. this rule will be matched if
// **any** one of the matches is satisfied. If unspecified (i.e. empty),
// this Rule will match all requests for the associated Listener.
//
// Each client request MUST map to a maximum of one route rule. If a request
// matches multiple rules, matching precedence MUST be determined in order
// of the following criteria, continuing on ties:
//
// * The longest matching SNI.
// * The longest matching precise SNI (without a wildcard). This means that
// "b.example.com" should be given precedence over "*.example.com".
// * The most specific match specified by ExtensionRef. Each implementation
// that supports ExtensionRef may have different ways of determining the
// specificity of the referenced extension.
//
// If ties still exist across multiple Routes, matching precedence MUST be
// determined in order of the following criteria, continuing on ties:
//
// * The oldest Route based on creation timestamp. For example, a Route with
// a creation timestamp of "2020-09-08 01:02:03" is given precedence over
// a Route with a creation timestamp of "2020-09-08 01:02:04".
// * The Route appearing first in alphabetical order by
// "<namespace>/<name>". For example, foo/bar is given precedence over
// foo/baz.
//
// If ties still exist within the Route that has been given precedence,
// matching precedence MUST be granted to the first matching rule meeting
// the above criteria.
// Matches define conditions used for matching the rule against incoming UDP
// connections. No matching criteria exists currently but MAY be added in
// future. This implies that it is not possible to define match semantics
// within this resource and that any given listener on the Gateway MUST
// match a single Route resource and a single rule within the Route
// resource.
//
// +optional
// +kubebuilder:validation:MaxItems=8
// +kubebuilder:validation:MaxItems=0
Matches []TLSRouteMatch `json:"matches,omitempty"`

// BackendRefs defines the backend(s) where matching requests should be
Expand All @@ -144,19 +121,9 @@ type TLSRouteRule struct {
BackendRefs []BackendRef `json:"backendRefs,omitempty"`
}

// TLSRouteMatch defines the predicate used to match connections to a
// given action.
// TLSRouteMatch defines the predicate used to match TLS sessions to a given
// backend. No matching criteria exists currently but MAY be added in future.
type TLSRouteMatch struct {
// ExtensionRef is an optional, implementation-specific extension to the
// "match" behavior. For example, resource "mytcproutematcher" in group
// "networking.example.net". If the referent cannot be found, the rule MUST
// not be included in the route. The controller must ensure the
// "ResolvedRefs" condition on the Route status is set to `status: False`.
//
// Support: Custom
//
// +optional
ExtensionRef *LocalObjectReference `json:"extensionRef,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
46 changes: 8 additions & 38 deletions apis/v1alpha2/udproute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,34 +58,14 @@ type UDPRouteStatus struct {
// UDPRouteRule is the configuration for a given rule.
type UDPRouteRule struct {
// Matches define conditions used for matching the rule against incoming UDP
// connections. Each match is independent, i.e. this rule will be matched if
// **any** one of the matches is satisfied. If unspecified (i.e. empty),
// this Rule will match all requests for the associated Listener.
//
// Each client request MUST map to a maximum of one route rule. If a request
// matches multiple rules, matching precedence MUST be determined in order
// of the following criteria, continuing on ties:
//
// * The most specific match specified by ExtensionRef. Each implementation
// that supports ExtensionRef may have different ways of determining the
// specificity of the referenced extension.
//
// If ties still exist across multiple Routes, matching precedence MUST be
// determined in order of the following criteria, continuing on ties:
//
// * The oldest Route based on creation timestamp. For example, a Route with
// a creation timestamp of "2020-09-08 01:02:03" is given precedence over
// a Route with a creation timestamp of "2020-09-08 01:02:04".
// * The Route appearing first in alphabetical order by
// "<namespace>/<name>". For example, foo/bar is given precedence over
// foo/baz.
//
// If ties still exist within the Route that has been given precedence,
// matching precedence MUST be granted to the first matching rule meeting
// the above criteria.
// connections. No matching criteria exists currently but MAY be added in
// future. This implies that it is not possible to define match semantics
// within this resource and that any given listener on the Gateway MUST
// match a single Route resource and a single rule within the Route
// resource.
//
// +optional
// +kubebuilder:validation:MaxItems=8
// +kubebuilder:validation:MaxItems=0
Matches []UDPRouteMatch `json:"matches,omitempty"`

// BackendRefs defines the backend(s) where matching requests should be
Expand All @@ -105,19 +85,9 @@ type UDPRouteRule struct {
BackendRefs []BackendRef `json:"backendRefs,omitempty"`
}

// UDPRouteMatch defines the predicate used to match packets to a
// given action.
// UDPRouteMatch defines the predicate used to match UDP packets to a given
// backend. No matching criteria exists currently but MAY be added in future.
type UDPRouteMatch struct {
// ExtensionRef is an optional, implementation-specific extension to the
// "match" behavior. For example, resource "mytcproutematcher" in group
// "networking.example.net". If the referent cannot be found, the rule MUST
// not be included in the route. The controller must ensure the
// "ResolvedRefs" condition on the Route status is set to `status: False`.
//
// Support: Custom
//
// +optional
ExtensionRef *LocalObjectReference `json:"extensionRef,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
32 changes: 3 additions & 29 deletions apis/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 0 additions & 33 deletions config/crd/v1alpha2/gateway.networking.k8s.io_httproutes.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 59bc62c

Please sign in to comment.