Skip to content

Commit

Permalink
api: TcpKeepalive (downstream) in ClientTrafficPolicy (#1925)
Browse files Browse the repository at this point in the history
* api: TcpKeepAlive (downstream) in ClientTrafficPolicy

Relates to #1031

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* lint

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

---------

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
  • Loading branch information
arkodg authored Oct 5, 2023
1 parent dfbb776 commit 2ba50ea
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
29 changes: 29 additions & 0 deletions api/v1alpha1/clienttrafficpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down
35 changes: 35 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 @@ -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
Expand Down
17 changes: 17 additions & 0 deletions docs/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |



Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 2ba50ea

Please sign in to comment.