|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
package cli
|
|
|
|
package kube
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"bytes"
|
|
|
@ -24,19 +24,19 @@ import (
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type retryingRoundTripper struct {
|
|
|
|
type RetryingRoundTripper struct {
|
|
|
|
wrapped http.RoundTripper
|
|
|
|
Wrapped http.RoundTripper
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (rt *retryingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
|
|
|
func (rt *RetryingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
|
|
|
return rt.roundTrip(req, 1, nil)
|
|
|
|
return rt.roundTrip(req, 1, nil)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (rt *retryingRoundTripper) roundTrip(req *http.Request, retry int, prevResp *http.Response) (*http.Response, error) {
|
|
|
|
func (rt *RetryingRoundTripper) roundTrip(req *http.Request, retry int, prevResp *http.Response) (*http.Response, error) {
|
|
|
|
if retry < 0 {
|
|
|
|
if retry < 0 {
|
|
|
|
return prevResp, nil
|
|
|
|
return prevResp, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
resp, rtErr := rt.wrapped.RoundTrip(req)
|
|
|
|
resp, rtErr := rt.Wrapped.RoundTrip(req)
|
|
|
|
if rtErr != nil {
|
|
|
|
if rtErr != nil {
|
|
|
|
return resp, rtErr
|
|
|
|
return resp, rtErr
|
|
|
|
}
|
|
|
|
}
|