diff --git a/api/v1alpha1/clienttrafficpolicy_types.go b/api/v1alpha1/clienttrafficpolicy_types.go index 33f7228f50f..24a82ce1140 100644 --- a/api/v1alpha1/clienttrafficpolicy_types.go +++ b/api/v1alpha1/clienttrafficpolicy_types.go @@ -8,6 +8,7 @@ package v1alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" gwapiv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + gwapiv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) const ( @@ -41,6 +42,34 @@ type ClientTrafficPolicySpec struct { // for this Policy to have effect and be applied to the Gateway. // TargetRef TargetRef gwapiv1a2.PolicyTargetReferenceWithSectionName `json:"targetRef"` + // TcpKeepalive settings associated with the downstream client connection. + // If defined, sets SO_KEEPALIVE on the listener socket to enable TCP Keepalives. + // Disabled by default. + // + // +optional + TCPKeepalive *TCPKeepalive `json:"tcpKeepalive,omitempty"` +} + +// TCPKeepalive define the TCP Keepalive configuration. +type TCPKeepalive struct { + // The total number of unacknowledged probes to send before deciding + // the connection is dead. + // Defaults to 9. + // + // +optional + Probes *uint32 `json:"probes,omitempty"` + // The duration a connection needs to be idle before keep-alive + // probes start being sent. + // The duration format is + // Defaults to `7200s`. + // + // +optional + IdleTime *gwapiv1b1.Duration `json:"idleTime,omitempty"` + // The duration between keep-alive probes. + // Defaults to `75s`. + // + // +optional + Interval *gwapiv1b1.Duration `json:"interval,omitempty"` } // ClientTrafficPolicyStatus defines the state of ClientTrafficPolicy diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 8775f5b5ee7..b0a1f4f18c0 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -176,6 +176,11 @@ func (in *ClientTrafficPolicyList) DeepCopyObject() runtime.Object { func (in *ClientTrafficPolicySpec) DeepCopyInto(out *ClientTrafficPolicySpec) { *out = *in in.TargetRef.DeepCopyInto(&out.TargetRef) + if in.TCPKeepalive != nil { + in, out := &in.TCPKeepalive, &out.TCPKeepalive + *out = new(TCPKeepalive) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientTrafficPolicySpec. @@ -1869,6 +1874,36 @@ func (in *SourceMatch) DeepCopy() *SourceMatch { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TCPKeepalive) DeepCopyInto(out *TCPKeepalive) { + *out = *in + if in.Probes != nil { + in, out := &in.Probes, &out.Probes + *out = new(uint32) + **out = **in + } + if in.IdleTime != nil { + in, out := &in.IdleTime, &out.IdleTime + *out = new(v1beta1.Duration) + **out = **in + } + if in.Interval != nil { + in, out := &in.Interval, &out.Interval + *out = new(v1beta1.Duration) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPKeepalive. +func (in *TCPKeepalive) DeepCopy() *TCPKeepalive { + if in == nil { + return nil + } + out := new(TCPKeepalive) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TracingProvider) DeepCopyInto(out *TracingProvider) { *out = *in diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_clienttrafficpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_clienttrafficpolicies.yaml index 47014045b51..febd9eecc0b 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_clienttrafficpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_clienttrafficpolicies.yaml @@ -92,6 +92,28 @@ spec: - kind - name type: object + tcpKeepalive: + description: TcpKeepalive settings associated with the downstream + client connection. If defined, sets SO_KEEPALIVE on the listener + socket to enable TCP Keepalives. Disabled by default. + properties: + idleTime: + description: The duration a connection needs to be idle before + keep-alive probes start being sent. The duration format is Defaults + to `7200s`. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + interval: + description: The duration between keep-alive probes. Defaults + to `75s`. + pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$ + type: string + probes: + description: The total number of unacknowledged probes to send + before deciding the connection is dead. Defaults to 9. + format: int32 + type: integer + type: object required: - targetRef type: object diff --git a/docs/latest/api/extension_types.md b/docs/latest/api/extension_types.md index c9f64e8af4a..0c9c0ca74d2 100644 --- a/docs/latest/api/extension_types.md +++ b/docs/latest/api/extension_types.md @@ -135,6 +135,7 @@ _Appears in:_ | Field | Description | | --- | --- | | `targetRef` _[PolicyTargetReferenceWithSectionName](#policytargetreferencewithsectionname)_ | TargetRef is the name of the Gateway resource this policy is being attached to. This Policy and the TargetRef MUST be in the same namespace for this Policy to have effect and be applied to the Gateway. TargetRef | +| `tcpKeepalive` _[TCPKeepalive](#tcpkeepalive)_ | TcpKeepalive settings associated with the downstream client connection. If defined, sets SO_KEEPALIVE on the listener socket to enable TCP Keepalives. Disabled by default. | @@ -1422,6 +1423,22 @@ _Appears in:_ +## TCPKeepalive + + + +TCPKeepalive define the TCP Keepalive configuration. + +_Appears in:_ +- [ClientTrafficPolicySpec](#clienttrafficpolicyspec) + +| Field | Description | +| --- | --- | +| `probes` _integer_ | The total number of unacknowledged probes to send before deciding the connection is dead. Defaults to 9. | +| `idleTime` _Duration_ | The duration a connection needs to be idle before keep-alive probes start being sent. The duration format is Defaults to `7200s`. | +| `interval` _Duration_ | The duration between keep-alive probes. Defaults to `75s`. | + + ## TracingProvider