Skip to content

Commit d325715

Browse files
committed
Add section name to each route
1 parent 6446fac commit d325715

22 files changed

+344
-9
lines changed

apis/applyconfiguration/apis/v1/grpcrouterule.go

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

apis/applyconfiguration/apis/v1/httprouterule.go

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

apis/applyconfiguration/apis/v1alpha2/tcprouterule.go

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

apis/applyconfiguration/apis/v1alpha2/tlsrouterule.go

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

apis/applyconfiguration/apis/v1alpha2/udprouterule.go

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

apis/applyconfiguration/internal/internal.go

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

apis/v1/grpcroute_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,20 @@ type GRPCRouteSpec struct {
144144
// +optional
145145
// +kubebuilder:validation:MaxItems=16
146146
// +kubebuilder:validation:XValidation:message="While 16 rules and 64 matches per rule are allowed, the total number of matches across all rules in a route must be less than 128",rule="(self.size() > 0 ? (has(self[0].matches) ? self[0].matches.size() : 0) : 0) + (self.size() > 1 ? (has(self[1].matches) ? self[1].matches.size() : 0) : 0) + (self.size() > 2 ? (has(self[2].matches) ? self[2].matches.size() : 0) : 0) + (self.size() > 3 ? (has(self[3].matches) ? self[3].matches.size() : 0) : 0) + (self.size() > 4 ? (has(self[4].matches) ? self[4].matches.size() : 0) : 0) + (self.size() > 5 ? (has(self[5].matches) ? self[5].matches.size() : 0) : 0) + (self.size() > 6 ? (has(self[6].matches) ? self[6].matches.size() : 0) : 0) + (self.size() > 7 ? (has(self[7].matches) ? self[7].matches.size() : 0) : 0) + (self.size() > 8 ? (has(self[8].matches) ? self[8].matches.size() : 0) : 0) + (self.size() > 9 ? (has(self[9].matches) ? self[9].matches.size() : 0) : 0) + (self.size() > 10 ? (has(self[10].matches) ? self[10].matches.size() : 0) : 0) + (self.size() > 11 ? (has(self[11].matches) ? self[11].matches.size() : 0) : 0) + (self.size() > 12 ? (has(self[12].matches) ? self[12].matches.size() : 0) : 0) + (self.size() > 13 ? (has(self[13].matches) ? self[13].matches.size() : 0) : 0) + (self.size() > 14 ? (has(self[14].matches) ? self[14].matches.size() : 0) : 0) + (self.size() > 15 ? (has(self[15].matches) ? self[15].matches.size() : 0) : 0) <= 128"
147+
// +kubebuilder:validation:XValidation:message="Rule name must be unique within the route",rule="self.all(l1, !has(l1.name) || self.exists_one(l2, has(l2.name) && l1.name == l2.name))"
147148
Rules []GRPCRouteRule `json:"rules,omitempty"`
148149
}
149150

150151
// GRPCRouteRule defines the semantics for matching a gRPC request based on
151152
// conditions (matches), processing it (filters), and forwarding the request to
152153
// an API object (backendRefs).
153154
type GRPCRouteRule struct {
155+
// Name is the name of the route rule. This name MUST be unique within a Route if it is set.
156+
//
157+
// Support: Extended
158+
// +optional
159+
Name *SectionName `json:"name,omitempty"`
160+
154161
// Matches define conditions used for matching the rule against incoming
155162
// gRPC requests. Each match is independent, i.e. this rule will be matched
156163
// if **any** one of the matches is satisfied.

apis/v1/httproute_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ type HTTPRouteSpec struct {
117117
// Rules are a list of HTTP matchers, filters and actions.
118118
//
119119
// +optional
120+
// +kubebuilder:validation:XValidation:message="Rule name must be unique within the route",rule="self.all(l1, !has(l1.name) || self.exists_one(l2, has(l2.name) && l1.name == l2.name))"
120121
// +kubebuilder:validation:MaxItems=16
121122
// +kubebuilder:default={{matches: {{path: {type: "PathPrefix", value: "/"}}}}}
122123
// +kubebuilder:validation:XValidation:message="While 16 rules and 64 matches per rule are allowed, the total number of matches across all rules in a route must be less than 128",rule="(self.size() > 0 ? self[0].matches.size() : 0) + (self.size() > 1 ? self[1].matches.size() : 0) + (self.size() > 2 ? self[2].matches.size() : 0) + (self.size() > 3 ? self[3].matches.size() : 0) + (self.size() > 4 ? self[4].matches.size() : 0) + (self.size() > 5 ? self[5].matches.size() : 0) + (self.size() > 6 ? self[6].matches.size() : 0) + (self.size() > 7 ? self[7].matches.size() : 0) + (self.size() > 8 ? self[8].matches.size() : 0) + (self.size() > 9 ? self[9].matches.size() : 0) + (self.size() > 10 ? self[10].matches.size() : 0) + (self.size() > 11 ? self[11].matches.size() : 0) + (self.size() > 12 ? self[12].matches.size() : 0) + (self.size() > 13 ? self[13].matches.size() : 0) + (self.size() > 14 ? self[14].matches.size() : 0) + (self.size() > 15 ? self[15].matches.size() : 0) <= 128"
@@ -133,6 +134,12 @@ type HTTPRouteSpec struct {
133134
// +kubebuilder:validation:XValidation:message="Within backendRefs, when using RequestRedirect filter with path.replacePrefixMatch, exactly one PathPrefix match must be specified",rule="(has(self.backendRefs) && self.backendRefs.exists_one(b, (has(b.filters) && b.filters.exists_one(f, has(f.requestRedirect) && has(f.requestRedirect.path) && f.requestRedirect.path.type == 'ReplacePrefixMatch' && has(f.requestRedirect.path.replacePrefixMatch))) )) ? ((size(self.matches) != 1 || !has(self.matches[0].path) || self.matches[0].path.type != 'PathPrefix') ? false : true) : true"
134135
// +kubebuilder:validation:XValidation:message="Within backendRefs, When using URLRewrite filter with path.replacePrefixMatch, exactly one PathPrefix match must be specified",rule="(has(self.backendRefs) && self.backendRefs.exists_one(b, (has(b.filters) && b.filters.exists_one(f, has(f.urlRewrite) && has(f.urlRewrite.path) && f.urlRewrite.path.type == 'ReplacePrefixMatch' && has(f.urlRewrite.path.replacePrefixMatch))) )) ? ((size(self.matches) != 1 || !has(self.matches[0].path) || self.matches[0].path.type != 'PathPrefix') ? false : true) : true"
135136
type HTTPRouteRule struct {
137+
// Name is the name of the route rule. This name MUST be unique within a Route if it is set.
138+
//
139+
// Support: Extended
140+
// +optional
141+
Name *SectionName `json:"name,omitempty"`
142+
136143
// Matches define conditions used for matching the rule against incoming
137144
// HTTP requests. Each match is independent, i.e. this rule will be matched
138145
// if **any** one of the matches is satisfied.

apis/v1/zz_generated.deepcopy.go

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

apis/v1alpha2/tcproute_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ type TCPRouteSpec struct {
4949
//
5050
// +kubebuilder:validation:MinItems=1
5151
// +kubebuilder:validation:MaxItems=16
52+
// +kubebuilder:validation:XValidation:message="Rule name must be unique within the route",rule="self.all(l1, !has(l1.name) || self.exists_one(l2, has(l2.name) && l1.name == l2.name))"
5253
Rules []TCPRouteRule `json:"rules"`
5354
}
5455

@@ -59,6 +60,12 @@ type TCPRouteStatus struct {
5960

6061
// TCPRouteRule is the configuration for a given rule.
6162
type TCPRouteRule struct {
63+
// Name is the name of the route rule. This name MUST be unique within a Route if it is set.
64+
//
65+
// Support: Extended
66+
// +optional
67+
Name *SectionName `json:"name,omitempty"`
68+
6269
// BackendRefs defines the backend(s) where matching requests should be
6370
// sent. If unspecified or invalid (refers to a non-existent resource or a
6471
// Service with no endpoints), the underlying implementation MUST actively

0 commit comments

Comments
 (0)