Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions api/v1alpha1/envoyextensionypolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,22 @@ type EnvoyExtensionPolicy struct {
// +kubebuilder:validation:XValidation:rule="has(self.targetRef) ? self.targetRef.kind in ['Gateway', 'ListenerSet', 'HTTPRoute', 'GRPCRoute', 'UDPRoute', 'TCPRoute', 'TLSRoute'] : true", message="this policy can only have a targetRef.kind of Gateway/ListenerSet/HTTPRoute/GRPCRoute/TCPRoute/UDPRoute/TLSRoute"
// +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"
// +kubebuilder:validation:XValidation:rule="has(self.targetRefs) ? self.targetRefs.all(ref, ref.kind in ['Gateway', 'ListenerSet', 'HTTPRoute', 'GRPCRoute', 'UDPRoute', 'TCPRoute', 'TLSRoute']) : true ", message="this policy can only have a targetRefs[*].kind of Gateway/ListenerSet/HTTPRoute/GRPCRoute/TCPRoute/UDPRoute/TLSRoute"
// +kubebuilder:validation:XValidation:rule="!has(self.mergeType) || ((!has(self.targetRef) || self.targetRef.kind in ['HTTPRoute', 'GRPCRoute', 'UDPRoute', 'TCPRoute', 'TLSRoute']) && (!has(self.targetRefs) || self.targetRefs.all(ref, ref.kind in ['HTTPRoute', 'GRPCRoute', 'UDPRoute', 'TCPRoute', 'TLSRoute'])) && (!has(self.targetSelectors) || self.targetSelectors.all(sel, sel.kind in ['HTTPRoute', 'GRPCRoute', 'UDPRoute', 'TCPRoute', 'TLSRoute'])))", message="mergeType can only be used with xRoute targets"
type EnvoyExtensionPolicySpec struct {
PolicyTargetReferences `json:",inline"`

// MergeType determines how this configuration is merged with existing EnvoyExtensionPolicy
// configurations targeting a parent resource. When set, this configuration will be merged
// into the closest parent EnvoyExtensionPolicy in the route's attachment hierarchy (for
// example, one targeting a Gateway, Gateway listener, ListenerSet, or ListenerSet
// listener).
// Currently, this field can only be set when targeting xRoute resources.
// If unset, no merging occurs, and only the most specific configuration takes effect.
//
// +kubebuilder:validation:XValidation:rule="self != 'Replace'",message="Replace is not a valid MergeType for EnvoyExtensionPolicy"
// +optional
MergeType *MergeType `json:"mergeType,omitempty"`
Comment thread
kkk777-7 marked this conversation as resolved.
Comment thread
kkk777-7 marked this conversation as resolved.
Comment on lines +48 to +58

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will happen if there're multiple merge EEP target to same xRoute? only the first one will work?


// Wasm is a list of Wasm extensions to be loaded by the Gateway.
// Order matters, as the extensions will be loaded in the order they are
// defined in this list.
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -1796,6 +1796,19 @@ spec:
|| (self.type == 'ValueRef' && !has(self.inline) && has(self.valueRef))
maxItems: 16
type: array
mergeType:
description: |-
MergeType determines how this configuration is merged with existing EnvoyExtensionPolicy
configurations targeting a parent resource. When set, this configuration will be merged
into the closest parent EnvoyExtensionPolicy in the route's attachment hierarchy (for
example, one targeting a Gateway, Gateway listener, ListenerSet, or ListenerSet
listener).
Currently, this field can only be set when targeting xRoute resources.
If unset, no merging occurs, and only the most specific configuration takes effect.
type: string
x-kubernetes-validations:
- message: Replace is not a valid MergeType for EnvoyExtensionPolicy
rule: self != 'Replace'
targetRef:
description: |-
TargetRef is the name of the resource this policy is being attached to.
Expand Down Expand Up @@ -2358,6 +2371,13 @@ spec:
rule: 'has(self.targetRefs) ? self.targetRefs.all(ref, ref.kind in [''Gateway'',
''ListenerSet'', ''HTTPRoute'', ''GRPCRoute'', ''UDPRoute'', ''TCPRoute'',
''TLSRoute'']) : true '
- message: mergeType can only be used with xRoute targets
rule: '!has(self.mergeType) || ((!has(self.targetRef) || self.targetRef.kind
in [''HTTPRoute'', ''GRPCRoute'', ''UDPRoute'', ''TCPRoute'', ''TLSRoute''])
&& (!has(self.targetRefs) || self.targetRefs.all(ref, ref.kind in
[''HTTPRoute'', ''GRPCRoute'', ''UDPRoute'', ''TCPRoute'', ''TLSRoute'']))
&& (!has(self.targetSelectors) || self.targetSelectors.all(sel, sel.kind
in [''HTTPRoute'', ''GRPCRoute'', ''UDPRoute'', ''TCPRoute'', ''TLSRoute''])))'
status:
description: Status defines the current status of EnvoyExtensionPolicy.
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1795,6 +1795,19 @@ spec:
|| (self.type == 'ValueRef' && !has(self.inline) && has(self.valueRef))
maxItems: 16
type: array
mergeType:
description: |-
MergeType determines how this configuration is merged with existing EnvoyExtensionPolicy
configurations targeting a parent resource. When set, this configuration will be merged
into the closest parent EnvoyExtensionPolicy in the route's attachment hierarchy (for
example, one targeting a Gateway, Gateway listener, ListenerSet, or ListenerSet
listener).
Currently, this field can only be set when targeting xRoute resources.
If unset, no merging occurs, and only the most specific configuration takes effect.
type: string
x-kubernetes-validations:
- message: Replace is not a valid MergeType for EnvoyExtensionPolicy
rule: self != 'Replace'
targetRef:
description: |-
TargetRef is the name of the resource this policy is being attached to.
Expand Down Expand Up @@ -2357,6 +2370,13 @@ spec:
rule: 'has(self.targetRefs) ? self.targetRefs.all(ref, ref.kind in [''Gateway'',
''ListenerSet'', ''HTTPRoute'', ''GRPCRoute'', ''UDPRoute'', ''TCPRoute'',
''TLSRoute'']) : true '
- message: mergeType can only be used with xRoute targets
rule: '!has(self.mergeType) || ((!has(self.targetRef) || self.targetRef.kind
in [''HTTPRoute'', ''GRPCRoute'', ''UDPRoute'', ''TCPRoute'', ''TLSRoute''])
&& (!has(self.targetRefs) || self.targetRefs.all(ref, ref.kind in
[''HTTPRoute'', ''GRPCRoute'', ''UDPRoute'', ''TCPRoute'', ''TLSRoute'']))
&& (!has(self.targetSelectors) || self.targetSelectors.all(sel, sel.kind
in [''HTTPRoute'', ''GRPCRoute'', ''UDPRoute'', ''TCPRoute'', ''TLSRoute''])))'
status:
description: Status defines the current status of EnvoyExtensionPolicy.
properties:
Expand Down
Loading