oauth2-proxy
oauth2-proxy copied to clipboard
feat: graceful shutdown to prevent 502 errors when oauth2-proxy is load balanced
This PR introduces a new shutdownDuration configuration variable which allows the proxy to shutdown gracefully.
After receiving a termination signal, proxy will keep serving traffic for shutdownDuration but will start returning a 503 error for its readiness /ready endpoint signaling to the load balancer to not send new traffic to it.
After shutdownDuration, proxy shuts down as usual.
Motivation and Context
Fixes https://github.com/oauth2-proxy/oauth2-proxy/issues/3066
How Has This Been Tested?
- Launch proxy
- Send SIGTERM
- Observe that proxy keeps serving traffic for
shutdownDurationseconds - While timeout hasn't elapsed
/readyendpoint returns an error - After timeout the proxy exits normally
Checklist:
- [x] My change requires a change to the documentation or CHANGELOG.
- [x] I have updated the documentation/CHANGELOG accordingly.
- [x] I have created a feature (non-master) branch for my PR.
- [ ] I have written tests for my code changes.
Thanks for the review @tuunit and @dolmen. I have addressed your comments in the last commit.