Skip to content

Commit b21a07a

Browse files
authored
Merge branch 'main' into docs/add-docs-for-helm-operator-oom
2 parents 15ec556 + 7c117ec commit b21a07a

18 files changed

+47
-7
lines changed

deployments/common/crds/k8s.nginx.org_virtualserverroutes.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,8 @@ spec:
515515
type: string
516516
jitter:
517517
type: string
518+
keepalive-time:
519+
type: string
518520
mandatory:
519521
type: boolean
520522
passes:

deployments/common/crds/k8s.nginx.org_virtualservers.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,8 @@ spec:
597597
type: string
598598
jitter:
599599
type: string
600+
keepalive-time:
601+
type: string
600602
mandatory:
601603
type: boolean
602604
passes:

deployments/helm-chart/crds/k8s.nginx.org_virtualserverroutes.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,8 @@ spec:
515515
type: string
516516
jitter:
517517
type: string
518+
keepalive-time:
519+
type: string
518520
mandatory:
519521
type: boolean
520522
passes:

deployments/helm-chart/crds/k8s.nginx.org_virtualservers.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,8 @@ spec:
597597
type: string
598598
jitter:
599599
type: string
600+
keepalive-time:
601+
type: string
600602
mandatory:
601603
type: boolean
602604
passes:

docs/content/configuration/virtualserver-and-virtualserverroute-resources.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ healthCheck:
411411
statusMatch: "! 500"
412412
mandatory: true
413413
persistent: true
414+
keepalive-time: 60s
414415
```
415416

416417
Note: This feature is supported only in NGINX Plus.
@@ -435,6 +436,7 @@ Note: This feature is supported only in NGINX Plus.
435436
|``grpcService`` | The gRPC service to be monitored on the upstream server. Only valid on gRPC type upstreams. | ``string`` | No |
436437
|``mandatory`` | Require every newly added server to pass all configured health checks before NGINX Plus sends traffic to it. If this is not specified, or is set to false, the server will be initially considered healthy. When combined with [slow-start](https://nginx.org/en/docs/http/ngx_http_upstream_module.html#slow_start), it gives a new server more time to connect to databases and “warm up” before being asked to handle their full share of traffic. | ``bool`` | No |
437438
|``persistent`` | Set the initial “up” state for a server after reload if the server was considered healthy before reload. Enabling persistent requires that the mandatory parameter is also set to `true`. | ``bool`` | No |
439+
|``keepalive-time`` | Enables [keepalive](https://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive) connections for health checks and specifies the time during which requests can be processed through one keepalive connection. The default is ``60s``. | ``string`` | No |
438440
{{% /table %}}
439441

440442
### Upstream.SessionCookie

examples/custom-resources/health-checks/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ spec:
2626
path: /healthz
2727
interval: 20s
2828
jitter: 3s
29+
keep_alive: 120s
2930
fails: 5
3031
passes: 5
3132
port: 8080

internal/configs/version2/http.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ type HealthCheck struct {
258258
GRPCService string
259259
Mandatory bool
260260
Persistent bool
261+
KeepaliveTime string
261262
}
262263

263264
// TLSRedirect defines a redirect in a Server.

internal/configs/version2/nginx-plus.virtualserver.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ server {
292292
fails={{ $hc.Fails }} passes={{ $hc.Passes }}{{ if $hc.Match }} match={{ $hc.Match }}{{ end }}
293293
{{ if $hc.Mandatory }} mandatory{{ if $hc.Persistent }} persistent{{ end }}{{ end }}
294294
{{ if $hc.GRPCPass }} type=grpc{{ if $hc.GRPCStatus }} grpc_status={{ $hc.GRPCStatus }}{{ end }}
295-
{{ if $hc.GRPCService }} grpc_service={{ $hc.GRPCService }}{{ end }}{{ end }};
295+
{{ if $hc.GRPCService }} grpc_service={{ $hc.GRPCService }}{{ end }}{{ end }} keepalive_time={{ $hc.KeepaliveTime }};
296296
}
297297
{{ end }}
298298

internal/configs/virtualserver.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ func newHealthCheckWithDefaults(upstream conf_v1.Upstream, upstreamName string,
211211
URI: uri,
212212
Interval: "5s",
213213
Jitter: "0s",
214+
KeepaliveTime: "60s",
214215
Fails: 1,
215216
Passes: 1,
216217
ProxyPass: fmt.Sprintf("%v://%v", generateProxyPassProtocol(upstream.TLS.Enable), upstreamName),
@@ -1396,6 +1397,10 @@ func generateHealthCheck(
13961397
hc.Jitter = generateTime(upstream.HealthCheck.Jitter)
13971398
}
13981399

1400+
if upstream.HealthCheck.KeepaliveTime != "" {
1401+
hc.KeepaliveTime = generateTime(upstream.HealthCheck.KeepaliveTime)
1402+
}
1403+
13991404
if upstream.HealthCheck.Fails > 0 {
14001405
hc.Fails = upstream.HealthCheck.Fails
14011406
}

internal/configs/virtualserver_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7100,6 +7100,7 @@ func TestNewHealthCheckWithDefaults(t *testing.T) {
71007100
URI: "/",
71017101
Interval: "5s",
71027102
Jitter: "0s",
7103+
KeepaliveTime: "60s",
71037104
Fails: 1,
71047105
Passes: 1,
71057106
Headers: make(map[string]string),
@@ -7128,6 +7129,7 @@ func TestGenerateHealthCheck(t *testing.T) {
71287129
Path: "/healthz",
71297130
Interval: "5s",
71307131
Jitter: "2s",
7132+
KeepaliveTime: "120s",
71317133
Fails: 3,
71327134
Passes: 2,
71337135
Port: 8080,
@@ -7157,6 +7159,7 @@ func TestGenerateHealthCheck(t *testing.T) {
71577159
URI: "/healthz",
71587160
Interval: "5s",
71597161
Jitter: "2s",
7162+
KeepaliveTime: "120s",
71607163
Fails: 3,
71617164
Passes: 2,
71627165
Port: 8080,
@@ -7187,6 +7190,7 @@ func TestGenerateHealthCheck(t *testing.T) {
71877190
URI: "/",
71887191
Interval: "5s",
71897192
Jitter: "0s",
7193+
KeepaliveTime: "60s",
71907194
Fails: 1,
71917195
Passes: 1,
71927196
Headers: make(map[string]string),
@@ -7209,6 +7213,7 @@ func TestGenerateHealthCheck(t *testing.T) {
72097213
URI: "/",
72107214
Interval: "5s",
72117215
Jitter: "0s",
7216+
KeepaliveTime: "60s",
72127217
Fails: 1,
72137218
Passes: 1,
72147219
Headers: make(map[string]string),
@@ -7227,6 +7232,7 @@ func TestGenerateHealthCheck(t *testing.T) {
72277232
Enable: true,
72287233
Interval: "1m 5s",
72297234
Jitter: "2m 3s",
7235+
KeepaliveTime: "1m 6s",
72307236
ConnectTimeout: "1m 10s",
72317237
SendTimeout: "1m 20s",
72327238
ReadTimeout: "1m 30s",
@@ -7242,6 +7248,7 @@ func TestGenerateHealthCheck(t *testing.T) {
72427248
URI: "/",
72437249
Interval: "1m5s",
72447250
Jitter: "2m3s",
7251+
KeepaliveTime: "1m6s",
72457252
Fails: 1,
72467253
Passes: 1,
72477254
Headers: make(map[string]string),
@@ -7269,6 +7276,7 @@ func TestGenerateHealthCheck(t *testing.T) {
72697276
URI: "/",
72707277
Interval: "5s",
72717278
Jitter: "0s",
7279+
KeepaliveTime: "60s",
72727280
Fails: 1,
72737281
Passes: 1,
72747282
Headers: make(map[string]string),
@@ -7308,6 +7316,7 @@ func TestGenerateGrpcHealthCheck(t *testing.T) {
73087316
Enable: true,
73097317
Interval: "5s",
73107318
Jitter: "2s",
7319+
KeepaliveTime: "120s",
73117320
Fails: 3,
73127321
Passes: 2,
73137322
Port: 50051,
@@ -7339,6 +7348,7 @@ func TestGenerateGrpcHealthCheck(t *testing.T) {
73397348
GRPCPass: fmt.Sprintf("grpc://%v", upstreamName),
73407349
Interval: "5s",
73417350
Jitter: "2s",
7351+
KeepaliveTime: "120s",
73427352
Fails: 3,
73437353
Passes: 2,
73447354
Port: 50051,
@@ -7371,6 +7381,7 @@ func TestGenerateGrpcHealthCheck(t *testing.T) {
73717381
GRPCPass: fmt.Sprintf("grpc://%v", upstreamName),
73727382
Interval: "5s",
73737383
Jitter: "0s",
7384+
KeepaliveTime: "60s",
73747385
Fails: 1,
73757386
Passes: 1,
73767387
Headers: make(map[string]string),

0 commit comments

Comments
 (0)