From 785324827cd8ad5c69c0d6af23549b4ae5c8bfbd Mon Sep 17 00:00:00 2001 From: zhengtianbao Date: Thu, 2 Dec 2021 05:23:33 -0600 Subject: [PATCH] Set ingress-nginx default terminationGracePeriodSeconds to 5 min (#8252) * set ingress-nginx default terminationGracePeriodSeconds to 5 min for the drain of connection * Add ingress_nginx_termination_grace_period_seconds at sample inventory --- inventory/sample/group_vars/k8s_cluster/addons.yml | 1 + .../ingress_controller/ingress_nginx/defaults/main.yml | 1 + .../ingress_nginx/templates/ds-ingress-nginx-controller.yml.j2 | 1 + 3 files changed, 3 insertions(+) diff --git a/inventory/sample/group_vars/k8s_cluster/addons.yml b/inventory/sample/group_vars/k8s_cluster/addons.yml index 66b6d45f5..2a51fefdf 100644 --- a/inventory/sample/group_vars/k8s_cluster/addons.yml +++ b/inventory/sample/group_vars/k8s_cluster/addons.yml @@ -116,6 +116,7 @@ ingress_publish_status_address: "" # 53: "kube-system/coredns:53" # ingress_nginx_extra_args: # - --default-ssl-certificate=default/foo-tls +# ingress_nginx_termination_grace_period_seconds: 300 # ingress_nginx_class: nginx # ALB ingress controller deployment diff --git a/roles/kubernetes-apps/ingress_controller/ingress_nginx/defaults/main.yml b/roles/kubernetes-apps/ingress_controller/ingress_nginx/defaults/main.yml index ad9e83b5e..06ed7215b 100644 --- a/roles/kubernetes-apps/ingress_controller/ingress_nginx/defaults/main.yml +++ b/roles/kubernetes-apps/ingress_controller/ingress_nginx/defaults/main.yml @@ -12,4 +12,5 @@ ingress_nginx_configmap: {} ingress_nginx_configmap_tcp_services: {} ingress_nginx_configmap_udp_services: {} ingress_nginx_extra_args: [] +ingress_nginx_termination_grace_period_seconds: 300 # ingress_nginx_class: nginx diff --git a/roles/kubernetes-apps/ingress_controller/ingress_nginx/templates/ds-ingress-nginx-controller.yml.j2 b/roles/kubernetes-apps/ingress_controller/ingress_nginx/templates/ds-ingress-nginx-controller.yml.j2 index 6a71803c1..b9c9ee693 100644 --- a/roles/kubernetes-apps/ingress_controller/ingress_nginx/templates/ds-ingress-nginx-controller.yml.j2 +++ b/roles/kubernetes-apps/ingress_controller/ingress_nginx/templates/ds-ingress-nginx-controller.yml.j2 @@ -22,6 +22,7 @@ spec: prometheus.io/scrape: "true" spec: serviceAccountName: ingress-nginx + terminationGracePeriodSeconds: {{ ingress_nginx_termination_grace_period_seconds }} {% if ingress_nginx_host_network %} hostNetwork: true dnsPolicy: ClusterFirstWithHostNet