Skip to content

Commit 954a6b2

Browse files
authored
feat(lb): add new backend options: retries, redispatch and fastinter (#559)
1 parent a3aad98 commit 954a6b2

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

packages/clients/src/api/lb/v1/marshalling.gen.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ export const unmarshalHealthCheck = (data: unknown) => {
294294
tcpConfig: data.tcp_config
295295
? unmarshalHealthCheckTcpConfig(data.tcp_config)
296296
: undefined,
297+
transientCheckDelay: data.transient_check_delay,
297298
} as HealthCheck
298299
}
299300

@@ -363,10 +364,12 @@ export const unmarshalBackend = (data: unknown) => {
363364
id: data.id,
364365
ignoreSslServerVerify: data.ignore_ssl_server_verify,
365366
lb: data.lb ? unmarshalLb(data.lb) : undefined,
367+
maxRetries: data.max_retries,
366368
name: data.name,
367369
onMarkedDownAction: data.on_marked_down_action,
368370
pool: data.pool,
369371
proxyProtocol: data.proxy_protocol,
372+
redispatchAttemptCount: data.redispatch_attempt_count,
370373
sendProxyV2: data.send_proxy_v2,
371374
sslBridging: data.ssl_bridging,
372375
stickySessions: data.sticky_sessions,
@@ -887,6 +890,7 @@ const marshalHealthCheck = (
887890
check_send_proxy: request.checkSendProxy,
888891
check_timeout: request.checkTimeout,
889892
port: request.port,
893+
transient_check_delay: request.transientCheckDelay,
890894
...resolveOneOf<unknown>([
891895
{
892896
param: 'mysql_config',
@@ -1034,10 +1038,12 @@ export const marshalCreateBackendRequest = (
10341038
forward_protocol: request.forwardProtocol,
10351039
health_check: marshalHealthCheck(request.healthCheck, defaults),
10361040
ignore_ssl_server_verify: request.ignoreSslServerVerify,
1041+
max_retries: request.maxRetries,
10371042
name: request.name || randomName('lbb'),
10381043
on_marked_down_action:
10391044
request.onMarkedDownAction ?? 'on_marked_down_action_none',
10401045
proxy_protocol: request.proxyProtocol ?? 'proxy_protocol_unknown',
1046+
redispatch_attempt_count: request.redispatchAttemptCount,
10411047
send_proxy_v2: request.sendProxyV2,
10421048
server_ip: request.serverIp,
10431049
ssl_bridging: request.sslBridging,
@@ -1225,10 +1231,12 @@ export const marshalUpdateBackendRequest = (
12251231
forward_port_algorithm: request.forwardPortAlgorithm,
12261232
forward_protocol: request.forwardProtocol,
12271233
ignore_ssl_server_verify: request.ignoreSslServerVerify,
1234+
max_retries: request.maxRetries,
12281235
name: request.name,
12291236
on_marked_down_action:
12301237
request.onMarkedDownAction ?? 'on_marked_down_action_none',
12311238
proxy_protocol: request.proxyProtocol ?? 'proxy_protocol_unknown',
1239+
redispatch_attempt_count: request.redispatchAttemptCount,
12321240
send_proxy_v2: request.sendProxyV2,
12331241
ssl_bridging: request.sslBridging,
12341242
sticky_sessions: request.stickySessions,
@@ -1267,6 +1275,7 @@ export const marshalUpdateHealthCheckRequest = (
12671275
check_send_proxy: request.checkSendProxy,
12681276
check_timeout: request.checkTimeout,
12691277
port: request.port,
1278+
transient_check_delay: request.transientCheckDelay,
12701279
...resolveOneOf<unknown>([
12711280
{
12721281
param: 'mysql_config',
@@ -1414,10 +1423,12 @@ export const marshalZonedApiCreateBackendRequest = (
14141423
forward_protocol: request.forwardProtocol,
14151424
health_check: marshalHealthCheck(request.healthCheck, defaults),
14161425
ignore_ssl_server_verify: request.ignoreSslServerVerify,
1426+
max_retries: request.maxRetries,
14171427
name: request.name || randomName('lbb'),
14181428
on_marked_down_action:
14191429
request.onMarkedDownAction ?? 'on_marked_down_action_none',
14201430
proxy_protocol: request.proxyProtocol ?? 'proxy_protocol_unknown',
1431+
redispatch_attempt_count: request.redispatchAttemptCount,
14211432
send_proxy_v2: request.sendProxyV2,
14221433
server_ip: request.serverIp,
14231434
ssl_bridging: request.sslBridging,
@@ -1612,10 +1623,12 @@ export const marshalZonedApiUpdateBackendRequest = (
16121623
forward_port_algorithm: request.forwardPortAlgorithm,
16131624
forward_protocol: request.forwardProtocol,
16141625
ignore_ssl_server_verify: request.ignoreSslServerVerify,
1626+
max_retries: request.maxRetries,
16151627
name: request.name,
16161628
on_marked_down_action:
16171629
request.onMarkedDownAction ?? 'on_marked_down_action_none',
16181630
proxy_protocol: request.proxyProtocol ?? 'proxy_protocol_unknown',
1631+
redispatch_attempt_count: request.redispatchAttemptCount,
16191632
send_proxy_v2: request.sendProxyV2,
16201633
ssl_bridging: request.sslBridging,
16211634
sticky_sessions: request.stickySessions,
@@ -1654,6 +1667,7 @@ export const marshalZonedApiUpdateHealthCheckRequest = (
16541667
check_send_proxy: request.checkSendProxy,
16551668
check_timeout: request.checkTimeout,
16561669
port: request.port,
1670+
transient_check_delay: request.transientCheckDelay,
16571671
...resolveOneOf<unknown>([
16581672
{
16591673
param: 'mysql_config',

packages/clients/src/api/lb/v1/types.gen.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,10 @@ export interface Backend {
300300
sslBridging?: boolean
301301
/** Defines whether the server certificate verification should be ignored. */
302302
ignoreSslServerVerify?: boolean
303+
/** Whether to use another backend server on each attempt. */
304+
redispatchAttemptCount?: number
305+
/** Number of retries when a backend server connection failed. */
306+
maxRetries?: number
303307
}
304308

305309
/** Backend server stats. */
@@ -475,6 +479,11 @@ export interface HealthCheck {
475479
checkDelay?: string
476480
/** Defines whether proxy protocol should be activated for the health check. */
477481
checkSendProxy: boolean
482+
/**
483+
* Time to wait between two consecutive health checks when a backend server is
484+
* in a transient state (going UP or DOWN).
485+
*/
486+
transientCheckDelay?: string
478487
}
479488

480489
/** Health check. http config. */
@@ -1171,6 +1180,10 @@ export type CreateBackendRequest = {
11711180
sslBridging?: boolean
11721181
/** Defines whether the server certificate verification should be ignored. */
11731182
ignoreSslServerVerify?: boolean
1183+
/** Whether to use another backend server on each attempt. */
1184+
redispatchAttemptCount?: number
1185+
/** Number of retries when a backend server connection failed. */
1186+
maxRetries?: number
11741187
}
11751188

11761189
export type GetBackendRequest = {
@@ -1247,6 +1260,10 @@ export type UpdateBackendRequest = {
12471260
sslBridging?: boolean
12481261
/** Defines whether the server certificate verification should be ignored. */
12491262
ignoreSslServerVerify?: boolean
1263+
/** Whether to use another backend server on each retries. */
1264+
redispatchAttemptCount?: number
1265+
/** Number of retries when a backend server connection failed. */
1266+
maxRetries?: number
12501267
}
12511268

12521269
export type DeleteBackendRequest = {
@@ -1375,6 +1392,11 @@ export type UpdateHealthCheckRequest = {
13751392
httpsConfig?: HealthCheckHttpsConfig
13761393
/** Defines whether proxy protocol should be activated for the health check. */
13771394
checkSendProxy: boolean
1395+
/**
1396+
* Time to wait between two consecutive health checks when a backend server is
1397+
* in a transient state (going UP or DOWN).
1398+
*/
1399+
transientCheckDelay?: string
13781400
}
13791401

13801402
export type ListFrontendsRequest = {
@@ -2202,6 +2224,10 @@ export type ZonedApiCreateBackendRequest = {
22022224
sslBridging?: boolean
22032225
/** Defines whether the server certificate verification should be ignored. */
22042226
ignoreSslServerVerify?: boolean
2227+
/** Whether to use another backend server on each attempt. */
2228+
redispatchAttemptCount?: number
2229+
/** Number of retries when a backend server connection failed. */
2230+
maxRetries?: number
22052231
}
22062232

22072233
export type ZonedApiGetBackendRequest = {
@@ -2272,6 +2298,10 @@ export type ZonedApiUpdateBackendRequest = {
22722298
sslBridging?: boolean
22732299
/** Defines whether the server certificate verification should be ignored. */
22742300
ignoreSslServerVerify?: boolean
2301+
/** Whether to use another backend server on each retries. */
2302+
redispatchAttemptCount?: number
2303+
/** Number of retries when a backend server connection failed. */
2304+
maxRetries?: number
22752305
}
22762306

22772307
export type ZonedApiDeleteBackendRequest = {
@@ -2385,6 +2415,11 @@ export type ZonedApiUpdateHealthCheckRequest = {
23852415
httpsConfig?: HealthCheckHttpsConfig
23862416
/** Defines whether proxy protocol should be activated for the health check. */
23872417
checkSendProxy: boolean
2418+
/**
2419+
* Time to wait between two consecutive health checks when a backend server is
2420+
* in a transient state (going UP or DOWN).
2421+
*/
2422+
transientCheckDelay?: string
23882423
}
23892424

23902425
export type ZonedApiListFrontendsRequest = {

0 commit comments

Comments
 (0)