Merge pull request #105384 from seans3/command-headers-fix

Fixes kubectl command headers which hangs on kubectl run
This commit is contained in:
Kubernetes Prow Robot 2021-10-01 18:25:17 -07:00 committed by GitHub
commit e380ce5714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -420,8 +420,12 @@ func addCmdHeaderHooks(cmds *cobra.Command, kubeConfigFlags *genericclioptions.C
// Wraps CommandHeaderRoundTripper around standard RoundTripper.
kubeConfigFlags.WrapConfigFn = func(c *rest.Config) *rest.Config {
c.Wrap(func(rt http.RoundTripper) http.RoundTripper {
crt.Delegate = rt
return crt
// Must be separate RoundTripper; not "crt" closure.
// Fixes: https://github.com/kubernetes/kubectl/issues/1098
return &genericclioptions.CommandHeaderRoundTripper{
Delegate: rt,
Headers: crt.Headers,
}
})
return c
}