const kubectlCommandHeader … const kubectlSessionHeader … type CommandHeaderRoundTripper … // CommandHeaderRoundTripper adds Request headers before delegating to standard // round tripper. These headers are kubectl command headers which // detail the kubectl command. See SIG CLI KEP 859: // // https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/859-kubectl-headers func (c *CommandHeaderRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { … } // ParseCommandHeaders fills in a map of custom headers into the CommandHeaderRoundTripper. These // headers are then filled into each request. For details on the custom headers see: // // https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/859-kubectl-headers // // Each call overwrites the previously parsed command headers (not additive). // TODO(seans3): Parse/add flags removing PII from flag values. func (c *CommandHeaderRoundTripper) ParseCommandHeaders(cmd *cobra.Command, args []string) { … } // CancelRequest is propagated to the Delegate RoundTripper within // if the wrapped RoundTripper implements this function. func (c *CommandHeaderRoundTripper) CancelRequest(req *http.Request) { … }