internal/concierge/impersonator: ensure log statement is printed

When the frontend connection to our proxy is closed, the proxy falls through to
a panic(), which means the HTTP handler goroutine is killed, so we were not
seeing this log statement.

Signed-off-by: Andrew Keesler <akeesler@vmware.com>
This commit is contained in:
Andrew Keesler 2021-03-18 10:14:11 -04:00
parent 897340860b
commit aa79bc7609
No known key found for this signature in database
GPG Key ID: 27CE0444346F9413

View File

@ -270,6 +270,7 @@ 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
)
@ -278,8 +279,6 @@ func newImpersonationReverseProxyFunc(restConfig *rest.Config) (func(*genericapi
reverseProxy.Transport = rt
reverseProxy.FlushInterval = 200 * time.Millisecond // the "watch" verb will not work without this line
reverseProxy.ServeHTTP(w, r)
plog.Debug("impersonation proxy finished servicing request", "method", r.Method, "url", r.URL.String())
})
}, nil
}