diff --git a/haproxy-ingress/README.md b/haproxy-ingress/README.md index b6e6f8f..2de832f 100755 --- a/haproxy-ingress/README.md +++ b/haproxy-ingress/README.md @@ -103,6 +103,7 @@ Parameter | Description | Default `controller.hostNetwork` | Optionally set to true when using CNI based kubernetes installations | `false` `controller.dnsPolicy` | Optionally change this to ClusterFirstWithHostNet in case you have 'hostNetwork: true' | `ClusterFirst` `controller.terminationGracePeriodSeconds` | How much to wait before terminating a pod (in seconds) | `60` +`controller.lifecycle` | Lifecycle hooks for controller container | `{}` `controller.kind` | Type of deployment, DaemonSet or Deployment | `Deployment` `controller.tcp` | TCP [service ConfigMap](https://haproxy-ingress.github.io/docs/configuration/command-line/#tcp-services-configmap): `: /:[:[][:]]` | `{}` `controller.enableStaticPorts` | Set to `false` to only rely on ports from `controller.tcp` | `true` diff --git a/haproxy-ingress/templates/_podtemplate.yaml b/haproxy-ingress/templates/_podtemplate.yaml index 84041fe..25b0701 100644 --- a/haproxy-ingress/templates/_podtemplate.yaml +++ b/haproxy-ingress/templates/_podtemplate.yaml @@ -119,6 +119,10 @@ spec: {{- end }} resources: {{- toYaml .Values.controller.resources | nindent 8 }} +{{- if .Values.controller.lifecycle }} + lifecycle: + {{- toYaml .Values.controller.lifecycle | nindent 8 }} +{{- end }} {{- if .Values.controller.logs.enabled }} - name: access-logs image: "{{ .Values.controller.logs.image.repository }}:{{ .Values.controller.logs.image.tag }}" diff --git a/haproxy-ingress/values.yaml b/haproxy-ingress/values.yaml index dd8eeba..09bcb2a 100644 --- a/haproxy-ingress/values.yaml +++ b/haproxy-ingress/values.yaml @@ -119,6 +119,12 @@ controller: # How many seconds to wait before terminating a pod. terminationGracePeriodSeconds: 60 + # Configure container lifecycle. When scaling replicas down this can be + # used to prevent controller container from terminating quickly and drop in-flight requests. + # For example, when the controller runs behind Network Load Balancer this can be used + # to configure preStop hook to sleep along with deregistration_delay. + lifecycle: {} + ## DaemonSet or Deployment ## kind: Deployment