Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve shutdown logic: Wait until no requests are made #12397

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,3 @@ ${GO_BUILD_CMD} \
-X ${PKG}/version.REPO=${REPO_INFO}" \
-buildvcs=false \
-o "${TARGETS_DIR}/dbg" "${PKG}/cmd/dbg"

echo "Building ${PKG}/cmd/waitshutdown"

${GO_BUILD_CMD} \
-trimpath -ldflags="-buildid= -w -s \
-X ${PKG}/version.RELEASE=${TAG} \
-X ${PKG}/version.COMMIT=${COMMIT_SHA} \
-X ${PKG}/version.REPO=${REPO_INFO}" \
-buildvcs=false \
-o "${TARGETS_DIR}/wait-shutdown" "${PKG}/cmd/waitshutdown"
2 changes: 1 addition & 1 deletion charts/ingress-nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ metadata:
| controller.keda.triggers | list | `[]` | |
| controller.kind | string | `"Deployment"` | Use a `DaemonSet` or `Deployment` |
| controller.labels | object | `{}` | Labels to be added to the controller Deployment or DaemonSet and other resources that do not have option to specify labels # |
| 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. # |
| controller.lifecycle | object | `{}` | |
| controller.livenessProbe.failureThreshold | int | `5` | |
| controller.livenessProbe.httpGet.path | string | `"/healthz"` | |
| controller.livenessProbe.httpGet.port | int | `10254` | |
Expand Down
13 changes: 1 addition & 12 deletions charts/ingress-nginx/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -945,18 +945,7 @@ controller:
# annotations:
# description: Too many 4XXs
# summary: More than 5% of all requests returned 4XX, this requires your attention
# -- 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.
##
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
lifecycle: {}
priorityClassName: ""
# -- Rollback limit
##
Expand Down
43 changes: 0 additions & 43 deletions cmd/waitshutdown/main.go

This file was deleted.

8 changes: 3 additions & 5 deletions deploy/static/provider/aws/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ spec:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.12.0-beta.0
spec:
automountServiceAccountToken: true
containers:
- args:
- /nginx-ingress-controller
Expand All @@ -448,11 +449,6 @@ spec:
value: /usr/local/lib/libmimalloc.so
image: registry.k8s.io/ingress-nginx/controller:v1.12.0-beta.0@sha256:9724476b928967173d501040631b23ba07f47073999e80e34b120e8db5f234d5
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
livenessProbe:
failureThreshold: 5
httpGet:
Expand Down Expand Up @@ -537,6 +533,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-create
spec:
automountServiceAccountToken: true
containers:
- args:
- create
Expand Down Expand Up @@ -589,6 +586,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-patch
spec:
automountServiceAccountToken: true
containers:
- args:
- patch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ spec:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.12.0-beta.0
spec:
automountServiceAccountToken: true
containers:
- args:
- /nginx-ingress-controller
Expand All @@ -457,11 +458,6 @@ spec:
value: /usr/local/lib/libmimalloc.so
image: registry.k8s.io/ingress-nginx/controller:v1.12.0-beta.0@sha256:9724476b928967173d501040631b23ba07f47073999e80e34b120e8db5f234d5
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
livenessProbe:
failureThreshold: 5
httpGet:
Expand Down Expand Up @@ -549,6 +545,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-create
spec:
automountServiceAccountToken: true
containers:
- args:
- create
Expand Down Expand Up @@ -601,6 +598,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-patch
spec:
automountServiceAccountToken: true
containers:
- args:
- patch
Expand Down
8 changes: 3 additions & 5 deletions deploy/static/provider/baremetal/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ spec:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.12.0-beta.0
spec:
automountServiceAccountToken: true
containers:
- args:
- /nginx-ingress-controller
Expand All @@ -442,11 +443,6 @@ spec:
value: /usr/local/lib/libmimalloc.so
image: registry.k8s.io/ingress-nginx/controller:v1.12.0-beta.0@sha256:9724476b928967173d501040631b23ba07f47073999e80e34b120e8db5f234d5
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
livenessProbe:
failureThreshold: 5
httpGet:
Expand Down Expand Up @@ -531,6 +527,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-create
spec:
automountServiceAccountToken: true
containers:
- args:
- create
Expand Down Expand Up @@ -583,6 +580,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-patch
spec:
automountServiceAccountToken: true
containers:
- args:
- patch
Expand Down
8 changes: 3 additions & 5 deletions deploy/static/provider/cloud/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ spec:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.12.0-beta.0
spec:
automountServiceAccountToken: true
containers:
- args:
- /nginx-ingress-controller
Expand All @@ -444,11 +445,6 @@ spec:
value: /usr/local/lib/libmimalloc.so
image: registry.k8s.io/ingress-nginx/controller:v1.12.0-beta.0@sha256:9724476b928967173d501040631b23ba07f47073999e80e34b120e8db5f234d5
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
livenessProbe:
failureThreshold: 5
httpGet:
Expand Down Expand Up @@ -533,6 +529,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-create
spec:
automountServiceAccountToken: true
containers:
- args:
- create
Expand Down Expand Up @@ -585,6 +582,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-patch
spec:
automountServiceAccountToken: true
containers:
- args:
- patch
Expand Down
8 changes: 3 additions & 5 deletions deploy/static/provider/do/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ spec:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.12.0-beta.0
spec:
automountServiceAccountToken: true
containers:
- args:
- /nginx-ingress-controller
Expand All @@ -447,11 +448,6 @@ spec:
value: /usr/local/lib/libmimalloc.so
image: registry.k8s.io/ingress-nginx/controller:v1.12.0-beta.0@sha256:9724476b928967173d501040631b23ba07f47073999e80e34b120e8db5f234d5
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
livenessProbe:
failureThreshold: 5
httpGet:
Expand Down Expand Up @@ -536,6 +532,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-create
spec:
automountServiceAccountToken: true
containers:
- args:
- create
Expand Down Expand Up @@ -588,6 +585,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-patch
spec:
automountServiceAccountToken: true
containers:
- args:
- patch
Expand Down
8 changes: 3 additions & 5 deletions deploy/static/provider/exoscale/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ spec:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.12.0-beta.0
spec:
automountServiceAccountToken: true
containers:
- args:
- /nginx-ingress-controller
Expand All @@ -449,11 +450,6 @@ spec:
value: /usr/local/lib/libmimalloc.so
image: registry.k8s.io/ingress-nginx/controller:v1.12.0-beta.0@sha256:9724476b928967173d501040631b23ba07f47073999e80e34b120e8db5f234d5
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
livenessProbe:
failureThreshold: 5
httpGet:
Expand Down Expand Up @@ -542,6 +538,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-create
spec:
automountServiceAccountToken: true
containers:
- args:
- create
Expand Down Expand Up @@ -594,6 +591,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-patch
spec:
automountServiceAccountToken: true
containers:
- args:
- patch
Expand Down
11 changes: 4 additions & 7 deletions deploy/static/provider/kind/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ spec:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
type: NodePort
type: LoadBalancer
---
apiVersion: v1
kind: Service
Expand Down Expand Up @@ -419,6 +419,7 @@ spec:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.12.0-beta.0
spec:
automountServiceAccountToken: true
containers:
- args:
- /nginx-ingress-controller
Expand All @@ -444,11 +445,6 @@ spec:
value: /usr/local/lib/libmimalloc.so
image: registry.k8s.io/ingress-nginx/controller:v1.12.0-beta.0@sha256:9724476b928967173d501040631b23ba07f47073999e80e34b120e8db5f234d5
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
livenessProbe:
failureThreshold: 5
httpGet:
Expand Down Expand Up @@ -505,7 +501,6 @@ spec:
readOnly: true
dnsPolicy: ClusterFirst
nodeSelector:
ingress-ready: "true"
kubernetes.io/os: linux
serviceAccountName: ingress-nginx
terminationGracePeriodSeconds: 0
Expand Down Expand Up @@ -543,6 +538,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-create
spec:
automountServiceAccountToken: true
containers:
- args:
- create
Expand Down Expand Up @@ -595,6 +591,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-patch
spec:
automountServiceAccountToken: true
containers:
- args:
- patch
Expand Down
8 changes: 3 additions & 5 deletions deploy/static/provider/oracle/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ spec:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.12.0-beta.0
spec:
automountServiceAccountToken: true
containers:
- args:
- /nginx-ingress-controller
Expand All @@ -448,11 +449,6 @@ spec:
value: /usr/local/lib/libmimalloc.so
image: registry.k8s.io/ingress-nginx/controller:v1.12.0-beta.0@sha256:9724476b928967173d501040631b23ba07f47073999e80e34b120e8db5f234d5
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
livenessProbe:
failureThreshold: 5
httpGet:
Expand Down Expand Up @@ -537,6 +533,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-create
spec:
automountServiceAccountToken: true
containers:
- args:
- create
Expand Down Expand Up @@ -589,6 +586,7 @@ spec:
app.kubernetes.io/version: 1.12.0-beta.0
name: ingress-nginx-admission-patch
spec:
automountServiceAccountToken: true
containers:
- args:
- patch
Expand Down
Loading