diff --git a/chart/tests/helm_tests/airflow_aux/test_container_lifecycle.py b/chart/tests/helm_tests/airflow_aux/test_container_lifecycle.py index a1c2c63f6137a..ab8ee9cc65a29 100644 --- a/chart/tests/helm_tests/airflow_aux/test_container_lifecycle.py +++ b/chart/tests/helm_tests/airflow_aux/test_container_lifecycle.py @@ -55,7 +55,7 @@ def test_check_default_setting(self): assert jmespath.search("spec.template.spec.containers[0].lifecycle", doc) is None pgbouncer_default_value = { - "exec": {"command": ["/bin/sh", "-c", "killall -INT pgbouncer && sleep 120"]} + "exec": {"command": ["/bin/sh", "-c", "sleep 10 && killall -INT pgbouncer && sleep 20"]} } assert pgbouncer_default_value == jmespath.search( "spec.template.spec.containers[0].lifecycle.preStop", docs[-1] diff --git a/chart/values.schema.json b/chart/values.schema.json index 7eb865997c7b0..7027d8accc1e5 100644 --- a/chart/values.schema.json +++ b/chart/values.schema.json @@ -7827,7 +7827,7 @@ "command": [ "/bin/sh", "-c", - "killall -INT pgbouncer && sleep 120" + "sleep 10 && killall -INT pgbouncer && sleep 20" ] } } diff --git a/chart/values.yaml b/chart/values.yaml index 890f9976d970c..7535862a75abb 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -2859,8 +2859,9 @@ pgbouncer: containerLifecycleHooks: preStop: exec: - # Allow existing queries clients to complete within 120 seconds - command: ["/bin/sh", "-c", "killall -INT pgbouncer && sleep 120"] + # Sleep first to give time to Kubernetes for removing Service endpoints + # before PgBouncer stops accepting and draining existing connections. + command: ["/bin/sh", "-c", "sleep 10 && killall -INT pgbouncer && sleep 20"] metricsExporterSidecar: resources: {}