Skip to content

Commit 810e5a2

Browse files
authored
feat: support section name for BackendTrafficPolicy (#6888)
* feat: support attaching policy to section name level Signed-off-by: kkk777-7 <[email protected]>
1 parent dd35363 commit 810e5a2

File tree

33 files changed

+2515
-414
lines changed

33 files changed

+2515
-414
lines changed

api/v1alpha1/backendtrafficpolicy_types.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,8 @@ type BackendTrafficPolicy struct {
3939
// +kubebuilder:validation:XValidation:rule="(has(self.targetRef) && !has(self.targetRefs)) || (!has(self.targetRef) && has(self.targetRefs)) || (has(self.targetSelectors) && self.targetSelectors.size() > 0) ", message="either targetRef or targetRefs must be used"
4040
// +kubebuilder:validation:XValidation:rule="has(self.targetRef) ? self.targetRef.group == 'gateway.networking.k8s.io' : true ", message="this policy can only have a targetRef.group of gateway.networking.k8s.io"
4141
// +kubebuilder:validation:XValidation:rule="has(self.targetRef) ? self.targetRef.kind in ['Gateway', 'HTTPRoute', 'GRPCRoute', 'UDPRoute', 'TCPRoute', 'TLSRoute'] : true", message="this policy can only have a targetRef.kind of Gateway/HTTPRoute/GRPCRoute/TCPRoute/UDPRoute/TLSRoute"
42-
// +kubebuilder:validation:XValidation:rule="has(self.targetRef) ? !has(self.targetRef.sectionName) : true",message="this policy does not yet support the sectionName field"
4342
// +kubebuilder:validation:XValidation:rule="has(self.targetRefs) ? self.targetRefs.all(ref, ref.group == 'gateway.networking.k8s.io') : true ", message="this policy can only have a targetRefs[*].group of gateway.networking.k8s.io"
4443
// +kubebuilder:validation:XValidation:rule="has(self.targetRefs) ? self.targetRefs.all(ref, ref.kind in ['Gateway', 'HTTPRoute', 'GRPCRoute', 'UDPRoute', 'TCPRoute', 'TLSRoute']) : true ", message="this policy can only have a targetRefs[*].kind of Gateway/HTTPRoute/GRPCRoute/TCPRoute/UDPRoute/TLSRoute"
45-
// +kubebuilder:validation:XValidation:rule="has(self.targetRefs) ? self.targetRefs.all(ref, !has(ref.sectionName)) : true",message="this policy does not yet support the sectionName field"
4644
// +kubebuilder:validation:XValidation:rule="!has(self.compression) || !has(self.compressor)", message="either compression or compressor can be set, not both"
4745
type BackendTrafficPolicySpec struct {
4846
PolicyTargetReferences `json:",inline"`

charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2416,18 +2416,13 @@ spec:
24162416
- message: this policy can only have a targetRef.kind of Gateway/HTTPRoute/GRPCRoute/TCPRoute/UDPRoute/TLSRoute
24172417
rule: 'has(self.targetRef) ? self.targetRef.kind in [''Gateway'', ''HTTPRoute'',
24182418
''GRPCRoute'', ''UDPRoute'', ''TCPRoute'', ''TLSRoute''] : true'
2419-
- message: this policy does not yet support the sectionName field
2420-
rule: 'has(self.targetRef) ? !has(self.targetRef.sectionName) : true'
24212419
- message: this policy can only have a targetRefs[*].group of gateway.networking.k8s.io
24222420
rule: 'has(self.targetRefs) ? self.targetRefs.all(ref, ref.group ==
24232421
''gateway.networking.k8s.io'') : true '
24242422
- message: this policy can only have a targetRefs[*].kind of Gateway/HTTPRoute/GRPCRoute/TCPRoute/UDPRoute/TLSRoute
24252423
rule: 'has(self.targetRefs) ? self.targetRefs.all(ref, ref.kind in [''Gateway'',
24262424
''HTTPRoute'', ''GRPCRoute'', ''UDPRoute'', ''TCPRoute'', ''TLSRoute''])
24272425
: true '
2428-
- message: this policy does not yet support the sectionName field
2429-
rule: 'has(self.targetRefs) ? self.targetRefs.all(ref, !has(ref.sectionName))
2430-
: true'
24312426
- message: either compression or compressor can be set, not both
24322427
rule: '!has(self.compression) || !has(self.compressor)'
24332428
- message: predictivePercent in preconnect policy only works with RoundRobin

charts/gateway-helm/crds/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2415,18 +2415,13 @@ spec:
24152415
- message: this policy can only have a targetRef.kind of Gateway/HTTPRoute/GRPCRoute/TCPRoute/UDPRoute/TLSRoute
24162416
rule: 'has(self.targetRef) ? self.targetRef.kind in [''Gateway'', ''HTTPRoute'',
24172417
''GRPCRoute'', ''UDPRoute'', ''TCPRoute'', ''TLSRoute''] : true'
2418-
- message: this policy does not yet support the sectionName field
2419-
rule: 'has(self.targetRef) ? !has(self.targetRef.sectionName) : true'
24202418
- message: this policy can only have a targetRefs[*].group of gateway.networking.k8s.io
24212419
rule: 'has(self.targetRefs) ? self.targetRefs.all(ref, ref.group ==
24222420
''gateway.networking.k8s.io'') : true '
24232421
- message: this policy can only have a targetRefs[*].kind of Gateway/HTTPRoute/GRPCRoute/TCPRoute/UDPRoute/TLSRoute
24242422
rule: 'has(self.targetRefs) ? self.targetRefs.all(ref, ref.kind in [''Gateway'',
24252423
''HTTPRoute'', ''GRPCRoute'', ''UDPRoute'', ''TCPRoute'', ''TLSRoute''])
24262424
: true '
2427-
- message: this policy does not yet support the sectionName field
2428-
rule: 'has(self.targetRefs) ? self.targetRefs.all(ref, !has(ref.sectionName))
2429-
: true'
24302425
- message: either compression or compressor can be set, not both
24312426
rule: '!has(self.compression) || !has(self.compressor)'
24322427
- message: predictivePercent in preconnect policy only works with RoundRobin

0 commit comments

Comments
 (0)