From c531a6fb23429f7c06b6c40382b4029d4b26efd9 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Mon, 12 Apr 2021 16:47:57 -0700 Subject: [PATCH] Allow terminationGracePeriodSeconds to be configurable Set a default of 6 hours, but allow users to tell us to wait a longer or shorter time for executors to gracefully stop. Change-Id: I12aada7a3c3aaff7b8bbe51744a8dd4d367b6e5a --- doc/source/index.rst | 10 ++++++++++ zuul_operator/templates/zuul.yaml | 2 +- zuul_operator/zuul.py | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index 7e57bf9..786fee6 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -404,6 +404,16 @@ verbatim): The key name in the secret should be ``sshkey``. + .. attr:: terminationGracePeriodSeconds + :default: 21600 + + When performing a rolling restart of the executors, wait + this long for jobs to finish normally. If an executor + takes longer than this amount of time, it will be + hard-stopped (and jobs will abort and retry). The default + is 6 hours, but depending on the workload, a higher or + lower value may be appropriate. + .. attr:: merger .. attr:: count diff --git a/zuul_operator/templates/zuul.yaml b/zuul_operator/templates/zuul.yaml index 57c2e8c..ab8ae29 100644 --- a/zuul_operator/templates/zuul.yaml +++ b/zuul_operator/templates/zuul.yaml @@ -347,7 +347,7 @@ spec: {%- endfor %} securityContext: privileged: true - terminationGracePeriodSeconds: 3600 + terminationGracePeriodSeconds: {{ spec.executor.terminationGracePeriodSeconds }} lifecycle: preStop: exec: diff --git a/zuul_operator/zuul.py b/zuul_operator/zuul.py index 5ebcb99..0effd5a 100644 --- a/zuul_operator/zuul.py +++ b/zuul_operator/zuul.py @@ -69,6 +69,8 @@ class Zuul: '/etc/zuul/tenant/main.yaml' self.spec.setdefault('executor', {}).setdefault('count', 1) + self.spec.setdefault('executor', {}).setdefault( + 'terminationGracePeriodSeconds', 21600) self.spec.setdefault('merger', {}).setdefault('count', 0) self.spec.setdefault('web', {}).setdefault('count', 1) self.spec.setdefault('fingergw', {}).setdefault('count', 1)