Closed veckatimest closed 5 months ago
Super!
You could have changed it one time in the Dockerfile and then removed the command/args from the Kubernetes files. https://github.com/rfcx/rfcx-api/blob/6f71d67a15a0056b4b42428f47a36aacbcff0d94/build/Dockerfile#L33
β DoD
(use na when API docs (Release notes, etc) do not need to be updated)
π Summary
This change main part is the deployment.yaml
WHY: when deployment has only args, and no "command", then the command is "bash -c". So inside the pod we have something like "bash -c yarn start:core"
When kubernetes wants to gracefully stop the pod, it sends SIGTERM signal to the main process. But signal does not come into the node.js, it just terminates the bash command. So if we call "node path/file.js" then the main process is the node.js, and it can handle the SIGTERM.
I have tested it. After this change, logs got new messages regarding "Received signal...". And I have also tested that now after sigterm I receive started request. (And that the pod can finish it's busyness).
π Problems
π‘ More ideas
Write any more ideas you have