Home > front end >  Will defer function still get executed after a Kubernetes admission request has timed out?
Will defer function still get executed after a Kubernetes admission request has timed out?

Time:12-22

For example, a defer function is implemented within a webhook's logic (the webhook is written in Golang). The webhook times out after taking too long to complete. In this case, will the defer function still get executed?

The request timeout is set via context.WithTimeout for the webhook.

CodePudding user response:

It's usually a good idea to clearly mention what programming language you're talking about, although I can figure it out.

In Go, the defer functor (whatever you want to call it) will be executed when the method returns, no matter how it completes, unless you manage to kill the executing process in a drastic manner, and perhaps even then.

  • Related