Skip to content

Commit

Permalink
Merge pull request #5332 from aledbf/chart
Browse files Browse the repository at this point in the history
Add lifecycle hook and option to enable mimalloc
  • Loading branch information
k8s-ci-robot authored Apr 6, 2020
2 parents 42fcc07 + f266854 commit 83daceb
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 7 deletions.
4 changes: 4 additions & 0 deletions charts/ingress-nginx/templates/controller-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.controller.enableMimalloc }}
- name: LD_PRELOAD
value: /usr/local/lib/libmimalloc.so
{{- end }}
{{- if .Values.controller.extraEnvs }}
{{- toYaml .Values.controller.extraEnvs | nindent 12 }}
{{- end }}
Expand Down
4 changes: 4 additions & 0 deletions charts/ingress-nginx/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.controller.enableMimalloc }}
- name: LD_PRELOAD
value: /usr/local/lib/libmimalloc.so
{{- end }}
{{- if .Values.controller.extraEnvs }}
{{- toYaml .Values.controller.extraEnvs | nindent 12 }}
{{- end }}
Expand Down
22 changes: 19 additions & 3 deletions charts/ingress-nginx/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ controller:
# topologyKey: "kubernetes.io/hostname"

## terminationGracePeriodSeconds
## wait up to five minutes for the drain of connections
##
terminationGracePeriodSeconds: 60
terminationGracePeriodSeconds: 300

## Node labels for controller pod assignment
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
Expand Down Expand Up @@ -245,6 +246,11 @@ controller:
targetCPUUtilizationPercentage: 50
targetMemoryUtilizationPercentage: 50

## Enable mimalloc as a drop-in replacement for malloc.
## ref: https://github.com/microsoft/mimalloc
##
enableMimalloc: false

## Override NGINX template
customTemplate:
configMapName: ""
Expand Down Expand Up @@ -427,8 +433,18 @@ controller:
# description: Too many 4XXs
# summary: More than 5% of the all requests did return 4XX, this require your attention


lifecycle: {}
## 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 efectively take advantage of this feature, the Configmap feature
## worker-shutdown-timeout new value is 240s instead of 10s.
##
lifecycle:
preStop:
exec:
command:
- /wait-shutdown

priorityClassName: ""

Expand Down
7 changes: 6 additions & 1 deletion deploy/static/provider/aws/deploy-tls-termination.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ spec:
- name: controller
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.30.0
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
args:
- /nginx-ingress-controller
- --publish-service=ingress-nginx/ingress-nginx-controller
Expand Down Expand Up @@ -391,7 +396,7 @@ spec:
cpu: 100m
memory: 90Mi
serviceAccountName: ingress-nginx
terminationGracePeriodSeconds: 60
terminationGracePeriodSeconds: 300
volumes:
- name: webhook-cert
secret:
Expand Down
7 changes: 6 additions & 1 deletion deploy/static/provider/aws/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@ spec:
- name: controller
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.30.0
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
args:
- /nginx-ingress-controller
- --publish-service=ingress-nginx/ingress-nginx-controller
Expand Down Expand Up @@ -387,7 +392,7 @@ spec:
cpu: 100m
memory: 90Mi
serviceAccountName: ingress-nginx
terminationGracePeriodSeconds: 60
terminationGracePeriodSeconds: 300
volumes:
- name: webhook-cert
secret:
Expand Down
7 changes: 6 additions & 1 deletion deploy/static/provider/baremetal/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ spec:
- name: controller
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.30.0
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
args:
- /nginx-ingress-controller
- --election-id=ingress-controller-leader
Expand Down Expand Up @@ -380,7 +385,7 @@ spec:
cpu: 100m
memory: 90Mi
serviceAccountName: ingress-nginx
terminationGracePeriodSeconds: 60
terminationGracePeriodSeconds: 300
volumes:
- name: webhook-cert
secret:
Expand Down
7 changes: 6 additions & 1 deletion deploy/static/provider/cloud/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ spec:
- name: controller
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.30.0
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
args:
- /nginx-ingress-controller
- --publish-service=ingress-nginx/ingress-nginx-controller
Expand Down Expand Up @@ -382,7 +387,7 @@ spec:
cpu: 100m
memory: 90Mi
serviceAccountName: ingress-nginx
terminationGracePeriodSeconds: 60
terminationGracePeriodSeconds: 300
volumes:
- name: webhook-cert
secret:
Expand Down

0 comments on commit 83daceb

Please sign in to comment.