Worker SIGTERM behavior

Hi,
We’re running octopus workers in kubernetes, and are noticing that workers may terminate in the middle of a deployment if the underlying host is being emptied or similar.

My question is: What is the expected behavior for workers receiving a stop signal while performing a dpeloy? are they supposed to complete the deploy before shutting down or will they kill themselves immediately regardless of any ongoing deploy?

Hi @trond!

Thanks for reaching out, and for the great question. Sadly, the tentacle agent does not have a “drain” mode built-in, so a SIGTERM would result in the immediate termination of the pod/deployment process…

One option, just off the top of my head, could be doing a pgrep -P 1 loop in your PreStop Lifecycle hook to see if there are any child processes running off the tentacle process, and if there are results returned, sleep for x seconds - this would simulate a graceful shutdown and let the current deployment processes finish.

I hope this helps, and please let me know if you have any further questions.