Skip to content

Commit 4800307

Browse files
committed
Added ingress.shutdownDelaySeconds
1 parent e943203 commit 4800307

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

charts/generic-service/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ app:
9898
| `additionalMounts.PATH.name` | __required if used__ | The name of an additional volume to be mounted at `PATH` inside the container |
9999
| `additionalMounts.PATH.*` | __required if used__ | The configuration for the additional volume (e.g., `emptyDir: {}`) |
100100
| `ingress.enabled` | `false` | Enables ingress into the service (either cluster-internal or public) |
101+
| `ingress.shutdownDelaySeconds` | `5` | The number of seconds to delay shutting down the container once no new requests are being routed to it |
101102
| `ingress.port` | `80` | The container port ingress traffic is routed to |
102103
| `ingress.protocol` | `http` | The internal protocol used for ingress (e.g., `http`, `https`, `h2c`, `grpc`, `http2`/`h2` or `grpcs`) |
103104
| `ingress.timeoutSeconds` | | Number of seconds after which to timeout waiting for response from service; -1 for infinite |

charts/generic-service/templates/controller.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ spec:
194194
serviceAccountName: '{{ .Values.rbac.existingServiceAccount | default (include "generic-service.fullname" .) }}'
195195
{{- end }}
196196

197-
terminationGracePeriodSeconds: {{ .Values.maxShutdownSeconds | int }}
197+
terminationGracePeriodSeconds: {{ if and .Values.ingress.enabled .Values.ingress.shutdownDelaySeconds }}{{ add (.Values.maxShutdownSeconds | int) (.Values.ingress.shutdownDelaySeconds | int) }}{{ else }}{{ .Values.maxShutdownSeconds | int }}{{ end }}
198198

199199
{{- if .Values.scheduling.priority }}
200200
priorityClassName: {{ .Values.scheduling.priority }}
@@ -434,12 +434,12 @@ spec:
434434
{{ if $val }}value: {{ $val | quote }}{{ end }}
435435
{{- end }}
436436

437-
{{- if and .Values.ingress.enabled .Values.maxShutdownSeconds | int }}
437+
{{- if and .Values.ingress.enabled .Values.ingress.shutdownDelaySeconds }}
438438
# Delay shutdown to give ingress controller time to reroute traffic
439439
lifecycle:
440440
preStop:
441441
exec:
442-
command: ["sleep", "5"]
442+
command: ["sleep", "{{ .Values.ingress.shutdownDelaySeconds }}"]
443443
{{- end }}
444444

445445
{{- range .Values.sidecars }}

charts/generic-service/values.schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,11 @@
680680
"default": false,
681681
"description": "Enables ingress into the service (either cluster-internal or public)"
682682
},
683+
"shutdownDelaySeconds": {
684+
"type": "integer",
685+
"default": 5,
686+
"description": "The number of seconds to delay shutting down the container once no new requests are being routed to it"
687+
},
683688
"port": {
684689
"type": "integer",
685690
"default": 80,

charts/generic-service/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ additionalMounts: {}
105105

106106
ingress:
107107
enabled: false
108+
shutdownDelaySeconds: 5
108109
port: 80
109110
protocol: http
110111
timeoutSeconds: null

0 commit comments

Comments
 (0)