openfaas / golang-http-template

Golang templates for OpenFaaS using HTTP extensions
https://www.openfaas.com/
MIT License
106 stars 57 forks source link

Graceful shutdown for Kubernetes #35

Closed alexellis closed 4 years ago

alexellis commented 4 years ago

There appears to be an issue with graceful shutdowns. This occurs when Kubernetes sends a SIGTERM to our function's Pod.

We have two processes:

The of-watchdog catches the signal and waits for wait_timeout env-var, but the child process appears to die immediately

We need to copy the code / approach of the of-watchdog into the Go handler for all templates and test.

Task

Now fix the code and repeat

You should see that both processes wait at least wait_timeout before exiting.