Add a comment to impersonator.go

This commit is contained in:
Ryan Richard 2021-03-18 10:00:06 -07:00
parent 120e46b5f7
commit e4bf6e068f
1 changed files with 4 additions and 1 deletions

View File

@ -270,11 +270,14 @@ func newImpersonationReverseProxyFunc(restConfig *rest.Config) (func(*genericapi
}
plog.Debug("impersonation proxy servicing request", "method", r.Method, "url", r.URL.String())
defer plog.Debug("impersonation proxy finished servicing request", "method", r.Method, "url", r.URL.String())
plog.Trace("impersonation proxy servicing request was for user", "method", r.Method, "url", r.URL.String(),
"username", userInfo.GetName(), // this info leak seems fine for trace level logs
)
// The proxy library used below will panic when the client disconnects abruptly, so in order to
// assure that this log message is always printed at the end of this func, it must be deferred.
defer plog.Debug("impersonation proxy finished servicing request", "method", r.Method, "url", r.URL.String())
reverseProxy := httputil.NewSingleHostReverseProxy(serverURL)
reverseProxy.Transport = rt
reverseProxy.FlushInterval = 200 * time.Millisecond // the "watch" verb will not work without this line