Skip to content

Commit dafd754

Browse files
committed
Add section name to each route
1 parent a29ddd4 commit dafd754

24 files changed

+371
-17
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
@@ -143,13 +143,20 @@ type GRPCRouteSpec struct {
143143
//
144144
// +optional
145145
// +kubebuilder:validation:MaxItems=16
146+
// +kubebuilder:validation:XValidation:message="Route 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))"
146147
Rules []GRPCRouteRule `json:"rules,omitempty"`
147148
}
148149

149150
// GRPCRouteRule defines the semantics for matching a gRPC request based on
150151
// conditions (matches), processing it (filters), and forwarding the request to
151152
// an API object (backendRefs).
152153
type GRPCRouteRule struct {
154+
// Name is the name of the route rule. This name MUST be unique within a Route if it is set.
155+
//
156+
// Support: Extended
157+
// +optional
158+
Name *SectionName `json:"name,omitempty"`
159+
153160
// Matches define conditions used for matching the rule against incoming
154161
// gRPC requests. Each match is independent, i.e. this rule will be matched
155162
// 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="Route 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
Rules []HTTPRouteRule `json:"rules,omitempty"`
@@ -132,6 +133,12 @@ type HTTPRouteSpec struct {
132133
// +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"
133134
// +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"
134135
type HTTPRouteRule struct {
136+
// Name is the name of the route rule. This name MUST be unique within a Route if it is set.
137+
//
138+
// Support: Extended
139+
// +optional
140+
Name *SectionName `json:"name,omitempty"`
141+
135142
// Matches define conditions used for matching the rule against incoming
136143
// HTTP requests. Each match is independent, i.e. this rule will be matched
137144
// 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="Route 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)