Skip to content

Commit d740e5f

Browse files
committed
refactor: wait-shutdown preStop hook is not necessary
/wait-shutdown preStop script's only job is to send SIGTERM to nginx-ingress-controller, which is PID 1, so it's the same with or without in Kubernetes environments. See #6287 for discussion.
1 parent 0b903e9 commit d740e5f

File tree

16 files changed

+32
-119
lines changed

16 files changed

+32
-119
lines changed

build/build.sh

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,3 @@ ${GO_BUILD_CMD} \
5757
-X ${PKG}/version.REPO=${REPO_INFO}" \
5858
-buildvcs=false \
5959
-o "${TARGETS_DIR}/dbg" "${PKG}/cmd/dbg"
60-
61-
echo "Building ${PKG}/cmd/waitshutdown"
62-
63-
${GO_BUILD_CMD} \
64-
-trimpath -ldflags="-buildid= -w -s \
65-
-X ${PKG}/version.RELEASE=${TAG} \
66-
-X ${PKG}/version.COMMIT=${COMMIT_SHA} \
67-
-X ${PKG}/version.REPO=${REPO_INFO}" \
68-
-buildvcs=false \
69-
-o "${TARGETS_DIR}/wait-shutdown" "${PKG}/cmd/waitshutdown"

charts/ingress-nginx/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ metadata:
372372
| controller.keda.triggers | list | `[]` | |
373373
| controller.kind | string | `"Deployment"` | Use a `DaemonSet` or `Deployment` |
374374
| controller.labels | object | `{}` | Labels to be added to the controller Deployment or DaemonSet and other resources that do not have option to specify labels # |
375-
| controller.lifecycle | object | `{"preStop":{"exec":{"command":["/wait-shutdown"]}}}` | Improve connection draining when ingress controller pod is deleted using a lifecycle hook: With this new hook, we increased the default terminationGracePeriodSeconds from 30 seconds to 300, allowing the draining of connections up to five minutes. If the active connections end before that, the pod will terminate gracefully at that time. To effectively take advantage of this feature, the Configmap feature worker-shutdown-timeout new value is 240s instead of 10s. # |
375+
| controller.lifecycle | object | `{}` | |
376376
| controller.livenessProbe.failureThreshold | int | `5` | |
377377
| controller.livenessProbe.httpGet.path | string | `"/healthz"` | |
378378
| controller.livenessProbe.httpGet.port | int | `10254` | |

charts/ingress-nginx/values.yaml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -945,18 +945,7 @@ controller:
945945
# annotations:
946946
# description: Too many 4XXs
947947
# summary: More than 5% of all requests returned 4XX, this requires your attention
948-
# -- Improve connection draining when ingress controller pod is deleted using a lifecycle hook:
949-
# With this new hook, we increased the default terminationGracePeriodSeconds from 30 seconds
950-
# to 300, allowing the draining of connections up to five minutes.
951-
# If the active connections end before that, the pod will terminate gracefully at that time.
952-
# To effectively take advantage of this feature, the Configmap feature
953-
# worker-shutdown-timeout new value is 240s instead of 10s.
954-
##
955-
lifecycle:
956-
preStop:
957-
exec:
958-
command:
959-
- /wait-shutdown
948+
lifecycle: {}
960949
priorityClassName: ""
961950
# -- Rollback limit
962951
##

cmd/waitshutdown/main.go

Lines changed: 0 additions & 43 deletions
This file was deleted.

deploy/static/provider/aws/deploy.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ spec:
424424
app.kubernetes.io/part-of: ingress-nginx
425425
app.kubernetes.io/version: 1.12.0-beta.0
426426
spec:
427+
automountServiceAccountToken: true
427428
containers:
428429
- args:
429430
- /nginx-ingress-controller
@@ -448,11 +449,6 @@ spec:
448449
value: /usr/local/lib/libmimalloc.so
449450
image: registry.k8s.io/ingress-nginx/controller:v1.12.0-beta.0@sha256:9724476b928967173d501040631b23ba07f47073999e80e34b120e8db5f234d5
450451
imagePullPolicy: IfNotPresent
451-
lifecycle:
452-
preStop:
453-
exec:
454-
command:
455-
- /wait-shutdown
456452
livenessProbe:
457453
failureThreshold: 5
458454
httpGet:
@@ -537,6 +533,7 @@ spec:
537533
app.kubernetes.io/version: 1.12.0-beta.0
538534
name: ingress-nginx-admission-create
539535
spec:
536+
automountServiceAccountToken: true
540537
containers:
541538
- args:
542539
- create
@@ -589,6 +586,7 @@ spec:
589586
app.kubernetes.io/version: 1.12.0-beta.0
590587
name: ingress-nginx-admission-patch
591588
spec:
589+
automountServiceAccountToken: true
592590
containers:
593591
- args:
594592
- patch

deploy/static/provider/aws/nlb-with-tls-termination/deploy.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ spec:
433433
app.kubernetes.io/part-of: ingress-nginx
434434
app.kubernetes.io/version: 1.12.0-beta.0
435435
spec:
436+
automountServiceAccountToken: true
436437
containers:
437438
- args:
438439
- /nginx-ingress-controller
@@ -457,11 +458,6 @@ spec:
457458
value: /usr/local/lib/libmimalloc.so
458459
image: registry.k8s.io/ingress-nginx/controller:v1.12.0-beta.0@sha256:9724476b928967173d501040631b23ba07f47073999e80e34b120e8db5f234d5
459460
imagePullPolicy: IfNotPresent
460-
lifecycle:
461-
preStop:
462-
exec:
463-
command:
464-
- /wait-shutdown
465461
livenessProbe:
466462
failureThreshold: 5
467463
httpGet:
@@ -549,6 +545,7 @@ spec:
549545
app.kubernetes.io/version: 1.12.0-beta.0
550546
name: ingress-nginx-admission-create
551547
spec:
548+
automountServiceAccountToken: true
552549
containers:
553550
- args:
554551
- create
@@ -601,6 +598,7 @@ spec:
601598
app.kubernetes.io/version: 1.12.0-beta.0
602599
name: ingress-nginx-admission-patch
603600
spec:
601+
automountServiceAccountToken: true
604602
containers:
605603
- args:
606604
- patch

deploy/static/provider/baremetal/deploy.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ spec:
419419
app.kubernetes.io/part-of: ingress-nginx
420420
app.kubernetes.io/version: 1.12.0-beta.0
421421
spec:
422+
automountServiceAccountToken: true
422423
containers:
423424
- args:
424425
- /nginx-ingress-controller
@@ -442,11 +443,6 @@ spec:
442443
value: /usr/local/lib/libmimalloc.so
443444
image: registry.k8s.io/ingress-nginx/controller:v1.12.0-beta.0@sha256:9724476b928967173d501040631b23ba07f47073999e80e34b120e8db5f234d5
444445
imagePullPolicy: IfNotPresent
445-
lifecycle:
446-
preStop:
447-
exec:
448-
command:
449-
- /wait-shutdown
450446
livenessProbe:
451447
failureThreshold: 5
452448
httpGet:
@@ -531,6 +527,7 @@ spec:
531527
app.kubernetes.io/version: 1.12.0-beta.0
532528
name: ingress-nginx-admission-create
533529
spec:
530+
automountServiceAccountToken: true
534531
containers:
535532
- args:
536533
- create
@@ -583,6 +580,7 @@ spec:
583580
app.kubernetes.io/version: 1.12.0-beta.0
584581
name: ingress-nginx-admission-patch
585582
spec:
583+
automountServiceAccountToken: true
586584
containers:
587585
- args:
588586
- patch

deploy/static/provider/cloud/deploy.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ spec:
420420
app.kubernetes.io/part-of: ingress-nginx
421421
app.kubernetes.io/version: 1.12.0-beta.0
422422
spec:
423+
automountServiceAccountToken: true
423424
containers:
424425
- args:
425426
- /nginx-ingress-controller
@@ -444,11 +445,6 @@ spec:
444445
value: /usr/local/lib/libmimalloc.so
445446
image: registry.k8s.io/ingress-nginx/controller:v1.12.0-beta.0@sha256:9724476b928967173d501040631b23ba07f47073999e80e34b120e8db5f234d5
446447
imagePullPolicy: IfNotPresent
447-
lifecycle:
448-
preStop:
449-
exec:
450-
command:
451-
- /wait-shutdown
452448
livenessProbe:
453449
failureThreshold: 5
454450
httpGet:
@@ -533,6 +529,7 @@ spec:
533529
app.kubernetes.io/version: 1.12.0-beta.0
534530
name: ingress-nginx-admission-create
535531
spec:
532+
automountServiceAccountToken: true
536533
containers:
537534
- args:
538535
- create
@@ -585,6 +582,7 @@ spec:
585582
app.kubernetes.io/version: 1.12.0-beta.0
586583
name: ingress-nginx-admission-patch
587584
spec:
585+
automountServiceAccountToken: true
588586
containers:
589587
- args:
590588
- patch

deploy/static/provider/do/deploy.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ spec:
423423
app.kubernetes.io/part-of: ingress-nginx
424424
app.kubernetes.io/version: 1.12.0-beta.0
425425
spec:
426+
automountServiceAccountToken: true
426427
containers:
427428
- args:
428429
- /nginx-ingress-controller
@@ -447,11 +448,6 @@ spec:
447448
value: /usr/local/lib/libmimalloc.so
448449
image: registry.k8s.io/ingress-nginx/controller:v1.12.0-beta.0@sha256:9724476b928967173d501040631b23ba07f47073999e80e34b120e8db5f234d5
449450
imagePullPolicy: IfNotPresent
450-
lifecycle:
451-
preStop:
452-
exec:
453-
command:
454-
- /wait-shutdown
455451
livenessProbe:
456452
failureThreshold: 5
457453
httpGet:
@@ -536,6 +532,7 @@ spec:
536532
app.kubernetes.io/version: 1.12.0-beta.0
537533
name: ingress-nginx-admission-create
538534
spec:
535+
automountServiceAccountToken: true
539536
containers:
540537
- args:
541538
- create
@@ -588,6 +585,7 @@ spec:
588585
app.kubernetes.io/version: 1.12.0-beta.0
589586
name: ingress-nginx-admission-patch
590587
spec:
588+
automountServiceAccountToken: true
591589
containers:
592590
- args:
593591
- patch

deploy/static/provider/exoscale/deploy.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ spec:
425425
app.kubernetes.io/part-of: ingress-nginx
426426
app.kubernetes.io/version: 1.12.0-beta.0
427427
spec:
428+
automountServiceAccountToken: true
428429
containers:
429430
- args:
430431
- /nginx-ingress-controller
@@ -449,11 +450,6 @@ spec:
449450
value: /usr/local/lib/libmimalloc.so
450451
image: registry.k8s.io/ingress-nginx/controller:v1.12.0-beta.0@sha256:9724476b928967173d501040631b23ba07f47073999e80e34b120e8db5f234d5
451452
imagePullPolicy: IfNotPresent
452-
lifecycle:
453-
preStop:
454-
exec:
455-
command:
456-
- /wait-shutdown
457453
livenessProbe:
458454
failureThreshold: 5
459455
httpGet:
@@ -542,6 +538,7 @@ spec:
542538
app.kubernetes.io/version: 1.12.0-beta.0
543539
name: ingress-nginx-admission-create
544540
spec:
541+
automountServiceAccountToken: true
545542
containers:
546543
- args:
547544
- create
@@ -594,6 +591,7 @@ spec:
594591
app.kubernetes.io/version: 1.12.0-beta.0
595592
name: ingress-nginx-admission-patch
596593
spec:
594+
automountServiceAccountToken: true
597595
containers:
598596
- args:
599597
- patch

0 commit comments

Comments
 (0)