Fixes kubectl command headers which hangs on kubectl run

Kubernetes-commit: 1d1a5499e717b928c6b2782fdcad9fa4052a38a1
This commit is contained in:
Sean Sullivan 2021-09-30 13:53:00 -07:00 committed by Kubernetes Publisher
parent 1e432bea02
commit 8a45e525e5
1 changed files with 6 additions and 2 deletions

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
}