Merge pull request #55897 from juanvallejo/jvallejo/expose-backoff-and-limiter-rest-request

Automatic merge from submit-queue (batch tested with PRs 55642, 55897, 55835, 55496, 55313). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

add rest/request backoffMgr and throttle setters

**Release note**:
```release-note
NONE
```

Allows modifications to be made to a request's rate-limiter and backoff manager
from a `RequestOptions` func introduced in https://github.com/kubernetes/kubernetes/pull/55834

Depends on https://github.com/kubernetes/kubernetes/pull/55834

@enj @smarterclayton

Kubernetes-commit: 17ff3caff47a824a3f3e9ab6b1aa94d8de87f00e
This commit is contained in:
Kubernetes Publisher 2017-11-18 10:46:32 -08:00
commit 5b93d2bc5a
2 changed files with 714 additions and 696 deletions

1392
Godeps/Godeps.json generated

File diff suppressed because it is too large Load Diff

View File

@ -179,6 +179,24 @@ func (r *Request) Resource(resource string) *Request {
return r
}
// BackOff sets the request's backoff manager to the one specified,
// or defaults to the stub implementation if nil is provided
func (r *Request) BackOff(manager BackoffManager) *Request {
if manager == nil {
r.backoffMgr = &NoBackoff{}
return r
}
r.backoffMgr = manager
return r
}
// Throttle receives a rate-limiter and sets or replaces an existing request limiter
func (r *Request) Throttle(limiter flowcontrol.RateLimiter) *Request {
r.throttle = limiter
return r
}
// SubResource sets a sub-resource path which can be multiple segments segment after the resource
// name but before the suffix.
func (r *Request) SubResource(subresources ...string) *Request {