diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 371991712..b8e235292 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -592,11 +592,11 @@ }, { "ImportPath": "k8s.io/apimachinery", - "Rev": "845a0cbf0d16" + "Rev": "eb4ad4570127" }, { "ImportPath": "k8s.io/client-go", - "Rev": "0fcd5b52ae3f" + "Rev": "1ae532aad6ad" }, { "ImportPath": "k8s.io/component-base", diff --git a/go.mod b/go.mod index 3c77d32e4..584d7f7b0 100644 --- a/go.mod +++ b/go.mod @@ -45,8 +45,8 @@ require ( gopkg.in/yaml.v2 v2.2.8 gotest.tools v2.2.0+incompatible // indirect k8s.io/api v0.0.0-20200130072251-812149543c99 - k8s.io/apimachinery v0.0.0-20200130072110-845a0cbf0d16 - k8s.io/client-go v0.0.0-20200130072521-0fcd5b52ae3f + k8s.io/apimachinery v0.0.0-20200130072111-eb4ad4570127 + k8s.io/client-go v0.0.0-20200130072523-1ae532aad6ad k8s.io/component-base v0.0.0-20200130073007-c1abf0189091 k8s.io/klog v1.0.0 k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c @@ -59,7 +59,7 @@ replace ( golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13 golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13 k8s.io/api => k8s.io/api v0.0.0-20200130072251-812149543c99 - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200130072110-845a0cbf0d16 - k8s.io/client-go => k8s.io/client-go v0.0.0-20200130072521-0fcd5b52ae3f + k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200130072111-eb4ad4570127 + k8s.io/client-go => k8s.io/client-go v0.0.0-20200130072523-1ae532aad6ad k8s.io/component-base => k8s.io/component-base v0.0.0-20200130073007-c1abf0189091 ) diff --git a/go.sum b/go.sum index e01843b8a..cc2774f23 100644 --- a/go.sum +++ b/go.sum @@ -360,8 +360,8 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= k8s.io/api v0.0.0-20200130072251-812149543c99/go.mod h1:5hz1MDQLlgYnKttI81z5nZ8LGQtHE6oI6Ry3XcXnVAI= -k8s.io/apimachinery v0.0.0-20200130072110-845a0cbf0d16/go.mod h1:HJDBSLM+cx1vex4Ye4/ySVjb/6yt+PEBkK8g2alZ6LM= -k8s.io/client-go v0.0.0-20200130072521-0fcd5b52ae3f/go.mod h1:e2/TBKxAJO1u9+kDmNL19FOhAKA4Fp/63kBQ3iOrBRE= +k8s.io/apimachinery v0.0.0-20200130072111-eb4ad4570127/go.mod h1:f7PPp70QzCGGLJHvCtiN2lePa9CdVddeAdL5w7NdrrU= +k8s.io/client-go v0.0.0-20200130072523-1ae532aad6ad/go.mod h1:1IzWcSqMJwg2THGQsF6Bbx340lRBq6vB2zHCzcnavlo= k8s.io/component-base v0.0.0-20200130073007-c1abf0189091/go.mod h1:HzmjRJW6Bp7Gk7CjqmoXwm53pONGbanJQz54pUAyLtc= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= diff --git a/pkg/admission/plugin/webhook/mutating/dispatcher.go b/pkg/admission/plugin/webhook/mutating/dispatcher.go index 3d6f022e2..1d337fb43 100644 --- a/pkg/admission/plugin/webhook/mutating/dispatcher.go +++ b/pkg/admission/plugin/webhook/mutating/dispatcher.go @@ -24,6 +24,7 @@ import ( "time" jsonpatch "github.com/evanphx/json-patch" + apiequality "k8s.io/apimachinery/pkg/api/equality" "k8s.io/klog" @@ -235,7 +236,7 @@ func (a *mutatingDispatcher) callAttrMutatingHook(ctx context.Context, h *admiss defer cancel() } - r := client.Post().Context(ctx).Body(request) + r := client.Post().Body(request) // if the context has a deadline, set it as a parameter to inform the backend if deadline, hasDeadline := ctx.Deadline(); hasDeadline { @@ -250,7 +251,7 @@ func (a *mutatingDispatcher) callAttrMutatingHook(ctx context.Context, h *admiss } } - if err := r.Do().Into(response); err != nil { + if err := r.Do(ctx).Into(response); err != nil { return false, &webhookutil.ErrCallingWebhook{WebhookName: h.Name, Reason: err} } trace.Step("Request completed") diff --git a/pkg/admission/plugin/webhook/validating/dispatcher.go b/pkg/admission/plugin/webhook/validating/dispatcher.go index 781c4ea3e..ab6b03924 100644 --- a/pkg/admission/plugin/webhook/validating/dispatcher.go +++ b/pkg/admission/plugin/webhook/validating/dispatcher.go @@ -22,7 +22,7 @@ import ( "sync" "time" - "k8s.io/api/admissionregistration/v1" + v1 "k8s.io/api/admissionregistration/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime/schema" utilruntime "k8s.io/apimachinery/pkg/util/runtime" @@ -196,7 +196,7 @@ func (d *validatingDispatcher) callHook(ctx context.Context, h *v1.ValidatingWeb defer cancel() } - r := client.Post().Context(ctx).Body(request) + r := client.Post().Body(request) // if the context has a deadline, set it as a parameter to inform the backend if deadline, hasDeadline := ctx.Deadline(); hasDeadline { @@ -211,7 +211,7 @@ func (d *validatingDispatcher) callHook(ctx context.Context, h *v1.ValidatingWeb } } - if err := r.Do().Into(response); err != nil { + if err := r.Do(ctx).Into(response); err != nil { return &webhookutil.ErrCallingWebhook{WebhookName: h.Name, Reason: err} } trace.Step("Request completed") diff --git a/pkg/util/webhook/webhook_test.go b/pkg/util/webhook/webhook_test.go index d56599d98..7fda70874 100644 --- a/pkg/util/webhook/webhook_test.go +++ b/pkg/util/webhook/webhook_test.go @@ -37,7 +37,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" - "k8s.io/client-go/tools/clientcmd/api/v1" + v1 "k8s.io/client-go/tools/clientcmd/api/v1" ) const ( @@ -397,7 +397,7 @@ func TestTLSConfig(t *testing.T) { wh, err := NewGenericWebhook(runtime.NewScheme(), scheme.Codecs, configFile, groupVersions, retryBackoff) if err == nil { - err = wh.RestClient.Get().Do().Error() + err = wh.RestClient.Get().Do(context.TODO()).Error() } if err == nil { @@ -466,7 +466,7 @@ func TestRequestTimeout(t *testing.T) { resultCh := make(chan rest.Result) - go func() { resultCh <- wh.RestClient.Get().Do() }() + go func() { resultCh <- wh.RestClient.Get().Do(context.TODO()) }() select { case <-time.After(time.Second * 5): t.Errorf("expected request to timeout after %s", requestTimeout) @@ -552,7 +552,7 @@ func TestWithExponentialBackoff(t *testing.T) { } result := wh.WithExponentialBackoff(context.Background(), func() rest.Result { - return wh.RestClient.Get().Do() + return wh.RestClient.Get().Do(context.TODO()) }) var statusCode int @@ -564,7 +564,7 @@ func TestWithExponentialBackoff(t *testing.T) { } result = wh.WithExponentialBackoff(context.Background(), func() rest.Result { - return wh.RestClient.Get().Do() + return wh.RestClient.Get().Do(context.TODO()) }) result.StatusCode(&statusCode) diff --git a/plugin/pkg/audit/webhook/webhook.go b/plugin/pkg/audit/webhook/webhook.go index d0f053643..f73c1fd56 100644 --- a/plugin/pkg/audit/webhook/webhook.go +++ b/plugin/pkg/audit/webhook/webhook.go @@ -124,7 +124,7 @@ func (b *backend) processEvents(ev ...*auditinternal.Event) error { // allow enough time for the serialization/deserialization of audit events, which // contain nested request and response objects plus additional event fields. defer trace.LogIfLong(time.Duration(50+25*len(list.Items)) * time.Millisecond) - return b.w.RestClient.Post().Body(&list).Do() + return b.w.RestClient.Post().Body(&list).Do(context.TODO()) }).Error() } diff --git a/plugin/pkg/authenticator/token/webhook/webhook.go b/plugin/pkg/authenticator/token/webhook/webhook.go index 53c5d2285..1912959e5 100644 --- a/plugin/pkg/authenticator/token/webhook/webhook.go +++ b/plugin/pkg/authenticator/token/webhook/webhook.go @@ -198,7 +198,7 @@ type tokenReviewV1Client struct { func (t *tokenReviewV1Client) CreateContext(ctx context.Context, review *authenticationv1.TokenReview) (*authenticationv1.TokenReview, error) { result := &authenticationv1.TokenReview{} - err := t.w.RestClient.Post().Context(ctx).Body(review).Do().Into(result) + err := t.w.RestClient.Post().Body(review).Do(ctx).Into(result) return result, err } @@ -209,7 +209,7 @@ type tokenReviewV1beta1Client struct { func (t *tokenReviewV1beta1Client) CreateContext(ctx context.Context, review *authenticationv1.TokenReview) (*authenticationv1.TokenReview, error) { v1beta1Review := &authenticationv1beta1.TokenReview{Spec: v1SpecToV1beta1Spec(&review.Spec)} v1beta1Result := &authenticationv1beta1.TokenReview{} - err := t.w.RestClient.Post().Context(ctx).Body(v1beta1Review).Do().Into(v1beta1Result) + err := t.w.RestClient.Post().Body(v1beta1Review).Do(ctx).Into(v1beta1Result) if err != nil { return nil, err } diff --git a/plugin/pkg/authorizer/webhook/webhook.go b/plugin/pkg/authorizer/webhook/webhook.go index 3839d483e..fecf7aab8 100644 --- a/plugin/pkg/authorizer/webhook/webhook.go +++ b/plugin/pkg/authorizer/webhook/webhook.go @@ -289,7 +289,7 @@ type subjectAccessReviewV1Client struct { func (t *subjectAccessReviewV1Client) CreateContext(ctx context.Context, subjectAccessReview *authorizationv1.SubjectAccessReview) (*authorizationv1.SubjectAccessReview, error) { result := &authorizationv1.SubjectAccessReview{} - err := t.w.RestClient.Post().Context(ctx).Body(subjectAccessReview).Do().Into(result) + err := t.w.RestClient.Post().Body(subjectAccessReview).Do(ctx).Into(result) return result, err } @@ -300,7 +300,7 @@ type subjectAccessReviewV1beta1Client struct { func (t *subjectAccessReviewV1beta1Client) CreateContext(ctx context.Context, subjectAccessReview *authorizationv1.SubjectAccessReview) (*authorizationv1.SubjectAccessReview, error) { v1beta1Review := &authorizationv1beta1.SubjectAccessReview{Spec: v1SpecToV1beta1Spec(&subjectAccessReview.Spec)} v1beta1Result := &authorizationv1beta1.SubjectAccessReview{} - err := t.w.RestClient.Post().Context(ctx).Body(v1beta1Review).Do().Into(v1beta1Result) + err := t.w.RestClient.Post().Body(v1beta1Review).Do(ctx).Into(v1beta1Result) if err == nil { subjectAccessReview.Status = v1beta1StatusToV1Status(&v1beta1Result.Status) }