Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[master] Auto-update dependencies #4047

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ require (
k8s.io/apiserver v0.18.8
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451
knative.dev/pkg v0.0.0-20200911145400-2d4efecc6bc1
knative.dev/test-infra v0.0.0-20200910231400-cfba2288403d
knative.dev/pkg v0.0.0-20200914134901-948ac9f2ce99
knative.dev/test-infra v0.0.0-20200911201000-3f90e7c8f2fa
sigs.k8s.io/yaml v1.2.0
)

Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1801,16 +1801,16 @@ knative.dev/pkg v0.0.0-20200505191044-3da93ebb24c2/go.mod h1:Q6sL35DdGs8hIQZKdaC
knative.dev/pkg v0.0.0-20200515002500-16d7b963416f/go.mod h1:tMOHGbxtRz8zYFGEGpV/bpoTEM1o89MwYFC4YJXl3GY=
knative.dev/pkg v0.0.0-20200528142800-1c6815d7e4c9/go.mod h1:QgNZTxnwpB/oSpNcfnLVlw+WpEwwyKAvJlvR3hgeltA=
knative.dev/pkg v0.0.0-20200711004937-22502028e31a/go.mod h1:AqAJV6rYi8IGikDjJ/9ZQd9qKdkXVlesVnVjwx62YB8=
knative.dev/pkg v0.0.0-20200911145400-2d4efecc6bc1 h1:YO9A5F0xo6sTeJZyrV9/IIeVNfKqNz9udsWsofe9eQk=
knative.dev/pkg v0.0.0-20200911145400-2d4efecc6bc1/go.mod h1:igZfLQk2QpRo+cxbH4NfsgbdavqsXr1rMr818/xVu3c=
knative.dev/pkg v0.0.0-20200914134901-948ac9f2ce99 h1:1FL9I9NBJEPGdabcCPbqd/aP2UqQd08PhFORy+RBaoY=
knative.dev/pkg v0.0.0-20200914134901-948ac9f2ce99/go.mod h1:igZfLQk2QpRo+cxbH4NfsgbdavqsXr1rMr818/xVu3c=
knative.dev/test-infra v0.0.0-20200407185800-1b88cb3b45a5/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ=
knative.dev/test-infra v0.0.0-20200505052144-5ea2f705bb55/go.mod h1:WqF1Azka+FxPZ20keR2zCNtiQA1MP9ZB4BH4HuI+SIU=
knative.dev/test-infra v0.0.0-20200513011557-d03429a76034/go.mod h1:aMif0KXL4g19YCYwsy4Ocjjz5xgPlseYV+B95Oo4JGE=
knative.dev/test-infra v0.0.0-20200519015156-82551620b0a9/go.mod h1:A5b2OAXTOeHT3hHhVQm3dmtbuWvIDP7qzgtqxA3/2pE=
knative.dev/test-infra v0.0.0-20200707183444-aed09e56ddc7/go.mod h1:RjYAhXnZqeHw9+B0zsbqSPlae0lCvjekO/nw5ZMpLCs=
knative.dev/test-infra v0.0.0-20200909211651-72eb6ae3c773/go.mod h1:Pmg2c7Z7q7BGFUV/GOpU5BlrD3ePJft4MPqx8AYBplc=
knative.dev/test-infra v0.0.0-20200910231400-cfba2288403d h1:0rvMkMqr6RYsIn4iL/G71FC7B6srbUj59dyuPecuzsI=
knative.dev/test-infra v0.0.0-20200910231400-cfba2288403d/go.mod h1:Pmg2c7Z7q7BGFUV/GOpU5BlrD3ePJft4MPqx8AYBplc=
knative.dev/test-infra v0.0.0-20200911201000-3f90e7c8f2fa h1:p1gXSaviQgkr3yKzcKO0+xW5qOtTnOPKqgFviTQ/qoM=
knative.dev/test-infra v0.0.0-20200911201000-3f90e7c8f2fa/go.mod h1:Pmg2c7Z7q7BGFUV/GOpU5BlrD3ePJft4MPqx8AYBplc=
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
Expand Down
78 changes: 27 additions & 51 deletions vendor/knative.dev/pkg/test/spoof/spoof.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (r *Response) String() string {

// Interface defines the actions that can be performed by the spoofing client.
type Interface interface {
Do(*http.Request) (*Response, error)
Do(*http.Request, ...ErrorRetryChecker) (*Response, error)
Poll(*http.Request, ResponseChecker, ...ErrorRetryChecker) (*Response, error)
}

Expand Down Expand Up @@ -166,71 +166,47 @@ func ResolveEndpoint(ctx context.Context, kubeClientset *kubernetes.Clientset, d
// Do dispatches to the underlying http.Client.Do, spoofing domains as needed
// and transforming the http.Response into a spoof.Response.
// Each response is augmented with "ZipkinTraceID" header that identifies the zipkin trace corresponding to the request.
func (sc *SpoofingClient) Do(req *http.Request) (*Response, error) {
// Starting span to capture zipkin trace.
traceContext, span := trace.StartSpan(req.Context(), "SpoofingClient-Trace")
defer span.End()

// Check to see if the call to this method is coming from a Poll call.
logZipkinTrace := true
if req.Header.Get(pollReqHeader) != "" {
req.Header.Del(pollReqHeader)
logZipkinTrace = false
}
resp, err := sc.Client.Do(req.WithContext(traceContext))
if err != nil {
return nil, err
}

defer resp.Body.Close()

resp.Header.Add(zipkin.ZipkinTraceIDHeader, span.SpanContext().TraceID.String())
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}

spoofResp := &Response{
Status: resp.Status,
StatusCode: resp.StatusCode,
Header: resp.Header,
Body: body,
}

if logZipkinTrace {
sc.logZipkinTrace(spoofResp)
}

return spoofResp, nil
func (sc *SpoofingClient) Do(req *http.Request, errorRetryCheckers ...ErrorRetryChecker) (*Response, error) {
return sc.Poll(req, func(*Response) (bool, error) { return true, nil }, errorRetryCheckers...)
}

// Poll executes an http request until it satisfies the inState condition or encounters an error.
func (sc *SpoofingClient) Poll(req *http.Request, inState ResponseChecker, errorRetryCheckers ...ErrorRetryChecker) (*Response, error) {
var (
resp *Response
err error
)

err = wait.PollImmediate(sc.RequestInterval, sc.RequestTimeout, func() (bool, error) {
// As we may do multiple Do calls as part of a single Poll we add this temporary header
// to the request to indicate to Do method not to log Zipkin trace, instead it is
// handled by this method itself.
req.Header.Add(pollReqHeader, "True")
resp, err = sc.Do(req)
if len(errorRetryCheckers) == 0 {
errorRetryCheckers = []ErrorRetryChecker{DefaultErrorRetryChecker}
}

var resp *Response
err := wait.PollImmediate(sc.RequestInterval, sc.RequestTimeout, func() (bool, error) {
// Starting span to capture zipkin trace.
traceContext, span := trace.StartSpan(req.Context(), "SpoofingClient-Trace")
defer span.End()
rawResp, err := sc.Client.Do(req.WithContext(traceContext))
if err != nil {
if len(errorRetryCheckers) == 0 {
errorRetryCheckers = []ErrorRetryChecker{DefaultErrorRetryChecker}
}
for _, checker := range errorRetryCheckers {
retry, newErr := checker(err)
if retry {
sc.Logf("Retrying %s: %v", req.URL.String(), newErr)
return false, nil
}
}
sc.Logf("NOT Retrying %s: %v", req.URL.String(), err)
return true, err
}
defer rawResp.Body.Close()

body, err := ioutil.ReadAll(rawResp.Body)
if err != nil {
return true, err
}
rawResp.Header.Add(zipkin.ZipkinTraceIDHeader, span.SpanContext().TraceID.String())

resp = &Response{
Status: rawResp.Status,
StatusCode: rawResp.StatusCode,
Header: rawResp.Header,
Body: body,
}
return inState(resp)
})

Expand Down
4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ k8s.io/utils/buffer
k8s.io/utils/integer
k8s.io/utils/pointer
k8s.io/utils/trace
# knative.dev/pkg v0.0.0-20200911145400-2d4efecc6bc1
# knative.dev/pkg v0.0.0-20200914134901-948ac9f2ce99
## explicit
knative.dev/pkg/apiextensions/storageversion
knative.dev/pkg/apiextensions/storageversion/cmd/migrate
Expand Down Expand Up @@ -1128,7 +1128,7 @@ knative.dev/pkg/webhook/resourcesemantics
knative.dev/pkg/webhook/resourcesemantics/conversion
knative.dev/pkg/webhook/resourcesemantics/defaulting
knative.dev/pkg/webhook/resourcesemantics/validation
# knative.dev/test-infra v0.0.0-20200910231400-cfba2288403d
# knative.dev/test-infra v0.0.0-20200911201000-3f90e7c8f2fa
## explicit
knative.dev/test-infra/scripts
# sigs.k8s.io/structured-merge-diff/v3 v3.0.1-0.20200706213357-43c19bbb7fba
Expand Down