Skip to content

Commit ac49398

Browse files
committed
Support network relevant settings for s3 output
Signed-off-by: Anson <anson.liu@live.com>
1 parent 8d0c3ad commit ac49398

11 files changed

Lines changed: 751 additions & 2 deletions

File tree

apis/fluentbit/v1alpha2/plugins/output/s3_types.go

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,40 @@ type S3 struct {
6565
// Option to specify an AWS Profile for credentials.
6666
Profile string `json:"Profile,omitempty"`
6767
// Specify number of worker threads to use to output to S3
68-
Workers *int32 `json:"Workers,omitempty"`
69-
*plugins.TLS `json:"tls,omitempty"`
68+
Workers *int32 `json:"Workers,omitempty"`
69+
// Set maximum time expressed in seconds to wait for a TCP connection to be established, this include the TLS handshake time.
70+
ConnectTimeout *int32 `json:"ConnectTimeout,omitempty"`
71+
// On connection timeout, specify if it should log an error. When disabled, the timeout is logged as a debug message.
72+
ConnectTimeoutLogError *bool `json:"connectTimeoutLogError,omitempty"`
73+
// Select the primary DNS connection type (TCP or UDP).
74+
// +kubebuilder:validation:Enum:="TCP";"UDP"
75+
DNSMode *string `json:"DNSMode,omitempty"`
76+
// Prioritize IPv4 DNS results when trying to establish a connection.
77+
DNSPreferIPv4 *bool `json:"DNSPreferIPv4,omitempty"`
78+
// Prioritize IPV6 DNS results when trying to establish a connection.
79+
DNSPreferIPv6 *bool `json:"DNSPreferIPv6,omitempty"`
80+
// Set maximum time a connection can stay idle while assigned.
81+
IoTimeout *int32 `json:"IoTimeout,omitempty"`
82+
// Set maximum number of times a keepalive connection can be used before it is retired.
83+
KeepaliveMaxRecycle *int32 `json:"keepaliveMaxRecycle,omitempty"`
84+
// Set maximum number of TCP connections that can be established per worker.
85+
MaxWorkerConnections *int32 `json:"maxWorkerConnections,omitempty"`
86+
// Ignore the environment variables HTTP_PROXY, HTTPS_PROXY and NO_PROXY when set.
87+
ProxyEnvIgnore *bool `json:"proxyEnvIgnore,omitempty"`
88+
// Specify network address to bind for data traffic.
89+
SourceAddress *string `json:"sourceAddress,omitempty"`
90+
// Enable or disable connection keepalive support. Accepts a boolean value: on / off.
91+
// +kubebuilder:validation:Enum:="on";"off"
92+
Keepalive *string `json:"keepalive,omitempty"`
93+
// Interval between TCP keepalive probes when no response is received on a keepidle probe.
94+
TCPKeepaliveInterval *int32 `json:"tcpKeepaliveInterval,omitempty"`
95+
// Number of unacknowledged probes to consider a connection dead.
96+
TCPKeepaliveProbes *int32 `json:"tcpKeepaliveProbes,omitempty"`
97+
// Interval between the last data packet sent and the first TCP keepalive probe.
98+
TCPKeepaliveTime *int32 `json:"tcpKeepaliveTime,omitempty"`
99+
// Set maximum time expressed in seconds for an idle keepalive connection.
100+
KeepaliveIdleTimeout *int32 `json:"keepaliveIdleTimeout,omitempty"`
101+
*plugins.TLS `json:"tls,omitempty"`
70102
}
71103

72104
// Name implement Section() method
@@ -105,6 +137,21 @@ func (o *S3) Params(sl plugins.SecretLoader) (*params.KVs, error) {
105137
plugins.InsertKVString(kvs, "external_id", o.ExternalId)
106138
plugins.InsertKVString(kvs, "profile", o.Profile)
107139
plugins.InsertKVField(kvs, "workers", o.Workers)
140+
plugins.InsertKVField(kvs, "net.connect_timeout", o.ConnectTimeout)
141+
plugins.InsertKVField(kvs, "net.connect_timeout_log_error", o.ConnectTimeoutLogError)
142+
plugins.InsertKVField(kvs, "net.dns.mode", o.DNSMode)
143+
plugins.InsertKVField(kvs, "net.dns.prefer_ipv4", o.DNSPreferIPv4)
144+
plugins.InsertKVField(kvs, "net.dns.prefer_ipv6", o.DNSPreferIPv6)
145+
plugins.InsertKVField(kvs, "net.io_timeout", o.IoTimeout)
146+
plugins.InsertKVField(kvs, "net.keepalive_max_recycle", o.KeepaliveMaxRecycle)
147+
plugins.InsertKVField(kvs, "net.max_worker_connections", o.MaxWorkerConnections)
148+
plugins.InsertKVField(kvs, "net.proxy_env_ignore", o.ProxyEnvIgnore)
149+
plugins.InsertKVField(kvs, "net.source_address", o.SourceAddress)
150+
plugins.InsertKVField(kvs, "net.tcp_keepalive", o.Keepalive)
151+
plugins.InsertKVField(kvs, "net.tcp_keepalive_interval", o.TCPKeepaliveInterval)
152+
plugins.InsertKVField(kvs, "net.tcp_keepalive_probes", o.TCPKeepaliveProbes)
153+
plugins.InsertKVField(kvs, "net.tcp_keepalive_time", o.TCPKeepaliveTime)
154+
plugins.InsertKVField(kvs, "net.keepalive_idle_timeout", o.KeepaliveIdleTimeout)
108155

109156
if o.TLS != nil {
110157
tls, err := o.TLS.Params(sl)

apis/fluentbit/v1alpha2/plugins/output/s3_types_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,20 @@ func TestOutput_S3_Params(t *testing.T) {
4343
ExternalId: "external_id",
4444
Profile: "my-profile",
4545
Workers: utils.ToPtr[int32](1),
46+
ConnectTimeout: utils.ToPtr[int32](10),
47+
ConnectTimeoutLogError: utils.ToPtr(true),
48+
DNSMode: utils.ToPtr("TCP"),
49+
DNSPreferIPv4: utils.ToPtr(false),
50+
DNSPreferIPv6: utils.ToPtr(false),
51+
IoTimeout: utils.ToPtr[int32](0),
52+
KeepaliveMaxRecycle: utils.ToPtr[int32](2000),
53+
MaxWorkerConnections: utils.ToPtr[int32](0),
54+
ProxyEnvIgnore: utils.ToPtr(false),
55+
SourceAddress: utils.ToPtr("127.0.0.1"),
56+
Keepalive: utils.ToPtr("off"),
57+
TCPKeepaliveInterval: utils.ToPtr[int32](-1),
58+
TCPKeepaliveProbes: utils.ToPtr[int32](-1),
59+
TCPKeepaliveTime: utils.ToPtr[int32](-1),
4660
}
4761

4862
expected := params.NewKVs()
@@ -74,6 +88,20 @@ func TestOutput_S3_Params(t *testing.T) {
7488
expected.Insert("external_id", "external_id")
7589
expected.Insert("profile", "my-profile")
7690
expected.Insert("workers", "1")
91+
expected.Insert("net.connect_timeout", "10")
92+
expected.Insert("net.connect_timeout_log_error", "true")
93+
expected.Insert("net.dns.mode", "TCP")
94+
expected.Insert("net.dns.prefer_ipv4", "false")
95+
expected.Insert("net.dns.prefer_ipv6", "false")
96+
expected.Insert("net.io_timeout", "0")
97+
expected.Insert("net.keepalive_max_recycle", "2000")
98+
expected.Insert("net.max_worker_connections", "0")
99+
expected.Insert("net.proxy_env_ignore", "false")
100+
expected.Insert("net.source_address", "127.0.0.1")
101+
expected.Insert("net.tcp_keepalive", "off")
102+
expected.Insert("net.tcp_keepalive_interval", "-1")
103+
expected.Insert("net.tcp_keepalive_probes", "-1")
104+
expected.Insert("net.tcp_keepalive_time", "-1")
77105

78106
kvs, err := s3.Params(sl)
79107
g.Expect(err).NotTo(HaveOccurred())

apis/fluentbit/v1alpha2/plugins/output/zz_generated.deepcopy.go

Lines changed: 75 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_clusteroutputs.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3396,10 +3396,30 @@ spec:
33963396
Compression:
33973397
description: Compression type for S3 objects.
33983398
type: string
3399+
ConnectTimeout:
3400+
description: Set maximum time expressed in seconds to wait for
3401+
a TCP connection to be established, this include the TLS handshake
3402+
time.
3403+
format: int32
3404+
type: integer
33993405
ContentType:
34003406
description: A standard MIME type for the S3 object; this will
34013407
be set as the Content-Type HTTP header.
34023408
type: string
3409+
DNSMode:
3410+
description: Select the primary DNS connection type (TCP or UDP).
3411+
enum:
3412+
- TCP
3413+
- UDP
3414+
type: string
3415+
DNSPreferIPv4:
3416+
description: Prioritize IPv4 DNS results when trying to establish
3417+
a connection.
3418+
type: boolean
3419+
DNSPreferIPv6:
3420+
description: Prioritize IPV6 DNS results when trying to establish
3421+
a connection.
3422+
type: boolean
34033423
Endpoint:
34043424
description: Custom endpoint for the S3 API.
34053425
type: string
@@ -3408,6 +3428,11 @@ spec:
34083428
with the role_arn parameter if your role requires an external
34093429
ID.
34103430
type: string
3431+
IoTimeout:
3432+
description: Set maximum time a connection can stay idle while
3433+
assigned.
3434+
format: int32
3435+
type: integer
34113436
JsonDateFormat:
34123437
description: 'Specify the format of the date. Supported formats
34133438
are double, epoch, iso8601 (eg: 2018-05-30T09:39:52.000681Z)
@@ -3498,6 +3523,54 @@ spec:
34983523
to S3
34993524
format: int32
35003525
type: integer
3526+
connectTimeoutLogError:
3527+
description: On connection timeout, specify if it should log an
3528+
error. When disabled, the timeout is logged as a debug message.
3529+
type: boolean
3530+
keepalive:
3531+
description: 'Enable or disable connection keepalive support.
3532+
Accepts a boolean value: on / off.'
3533+
enum:
3534+
- "on"
3535+
- "off"
3536+
type: string
3537+
keepaliveIdleTimeout:
3538+
description: Set maximum time expressed in seconds for an idle
3539+
keepalive connection.
3540+
format: int32
3541+
type: integer
3542+
keepaliveMaxRecycle:
3543+
description: Set maximum number of times a keepalive connection
3544+
can be used before it is retired.
3545+
format: int32
3546+
type: integer
3547+
maxWorkerConnections:
3548+
description: Set maximum number of TCP connections that can be
3549+
established per worker.
3550+
format: int32
3551+
type: integer
3552+
proxyEnvIgnore:
3553+
description: Ignore the environment variables HTTP_PROXY, HTTPS_PROXY
3554+
and NO_PROXY when set.
3555+
type: boolean
3556+
sourceAddress:
3557+
description: Specify network address to bind for data traffic.
3558+
type: string
3559+
tcpKeepaliveInterval:
3560+
description: Interval between TCP keepalive probes when no response
3561+
is received on a keepidle probe.
3562+
format: int32
3563+
type: integer
3564+
tcpKeepaliveProbes:
3565+
description: Number of unacknowledged probes to consider a connection
3566+
dead.
3567+
format: int32
3568+
type: integer
3569+
tcpKeepaliveTime:
3570+
description: Interval between the last data packet sent and the
3571+
first TCP keepalive probe.
3572+
format: int32
3573+
type: integer
35013574
tls:
35023575
description: Fluent Bit provides integrated support for Transport
35033576
Layer Security (TLS) and it predecessor Secure Sockets Layer

charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_outputs.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3396,10 +3396,30 @@ spec:
33963396
Compression:
33973397
description: Compression type for S3 objects.
33983398
type: string
3399+
ConnectTimeout:
3400+
description: Set maximum time expressed in seconds to wait for
3401+
a TCP connection to be established, this include the TLS handshake
3402+
time.
3403+
format: int32
3404+
type: integer
33993405
ContentType:
34003406
description: A standard MIME type for the S3 object; this will
34013407
be set as the Content-Type HTTP header.
34023408
type: string
3409+
DNSMode:
3410+
description: Select the primary DNS connection type (TCP or UDP).
3411+
enum:
3412+
- TCP
3413+
- UDP
3414+
type: string
3415+
DNSPreferIPv4:
3416+
description: Prioritize IPv4 DNS results when trying to establish
3417+
a connection.
3418+
type: boolean
3419+
DNSPreferIPv6:
3420+
description: Prioritize IPV6 DNS results when trying to establish
3421+
a connection.
3422+
type: boolean
34033423
Endpoint:
34043424
description: Custom endpoint for the S3 API.
34053425
type: string
@@ -3408,6 +3428,11 @@ spec:
34083428
with the role_arn parameter if your role requires an external
34093429
ID.
34103430
type: string
3431+
IoTimeout:
3432+
description: Set maximum time a connection can stay idle while
3433+
assigned.
3434+
format: int32
3435+
type: integer
34113436
JsonDateFormat:
34123437
description: 'Specify the format of the date. Supported formats
34133438
are double, epoch, iso8601 (eg: 2018-05-30T09:39:52.000681Z)
@@ -3498,6 +3523,54 @@ spec:
34983523
to S3
34993524
format: int32
35003525
type: integer
3526+
connectTimeoutLogError:
3527+
description: On connection timeout, specify if it should log an
3528+
error. When disabled, the timeout is logged as a debug message.
3529+
type: boolean
3530+
keepalive:
3531+
description: 'Enable or disable connection keepalive support.
3532+
Accepts a boolean value: on / off.'
3533+
enum:
3534+
- "on"
3535+
- "off"
3536+
type: string
3537+
keepaliveIdleTimeout:
3538+
description: Set maximum time expressed in seconds for an idle
3539+
keepalive connection.
3540+
format: int32
3541+
type: integer
3542+
keepaliveMaxRecycle:
3543+
description: Set maximum number of times a keepalive connection
3544+
can be used before it is retired.
3545+
format: int32
3546+
type: integer
3547+
maxWorkerConnections:
3548+
description: Set maximum number of TCP connections that can be
3549+
established per worker.
3550+
format: int32
3551+
type: integer
3552+
proxyEnvIgnore:
3553+
description: Ignore the environment variables HTTP_PROXY, HTTPS_PROXY
3554+
and NO_PROXY when set.
3555+
type: boolean
3556+
sourceAddress:
3557+
description: Specify network address to bind for data traffic.
3558+
type: string
3559+
tcpKeepaliveInterval:
3560+
description: Interval between TCP keepalive probes when no response
3561+
is received on a keepidle probe.
3562+
format: int32
3563+
type: integer
3564+
tcpKeepaliveProbes:
3565+
description: Number of unacknowledged probes to consider a connection
3566+
dead.
3567+
format: int32
3568+
type: integer
3569+
tcpKeepaliveTime:
3570+
description: Interval between the last data packet sent and the
3571+
first TCP keepalive probe.
3572+
format: int32
3573+
type: integer
35013574
tls:
35023575
description: Fluent Bit provides integrated support for Transport
35033576
Layer Security (TLS) and it predecessor Secure Sockets Layer

0 commit comments

Comments
 (0)