Merge pull request #87597 from mikedanese/rctx

Refactor context handling in rest.Request

Kubernetes-commit: 60dd5dbd8b2347284b7e9b87a5700f54c185034e
This commit is contained in:
Kubernetes Publisher 2020-01-29 22:11:03 -08:00
commit 9d489c7b9d
4 changed files with 22 additions and 21 deletions

6
Godeps/Godeps.json generated
View File

@ -352,15 +352,15 @@
},
{
"ImportPath": "k8s.io/apimachinery",
"Rev": "845a0cbf0d16"
"Rev": "eb4ad4570127"
},
{
"ImportPath": "k8s.io/client-go",
"Rev": "0fcd5b52ae3f"
"Rev": "1ae532aad6ad"
},
{
"ImportPath": "k8s.io/code-generator",
"Rev": "c3c22629838a"
"Rev": "7dfd5e9157ef"
},
{
"ImportPath": "k8s.io/gengo",

12
go.mod
View File

@ -6,9 +6,9 @@ go 1.13
require (
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/code-generator v0.0.0-20200129031917-c3c22629838a
k8s.io/apimachinery v0.0.0-20200130072111-eb4ad4570127
k8s.io/client-go v0.0.0-20200130072523-1ae532aad6ad
k8s.io/code-generator v0.0.0-20200130061103-7dfd5e9157ef
k8s.io/klog v1.0.0
)
@ -16,7 +16,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/code-generator => k8s.io/code-generator v0.0.0-20200129031917-c3c22629838a
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/code-generator => k8s.io/code-generator v0.0.0-20200130061103-7dfd5e9157ef
)

6
go.sum
View File

@ -206,9 +206,9 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/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/code-generator v0.0.0-20200129031917-c3c22629838a/go.mod h1:NAaJDQco+Cl4r3iPb/hSe4nHkLV7qLo851pX3qtK/Hs=
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/code-generator v0.0.0-20200130061103-7dfd5e9157ef/go.mod h1:NAaJDQco+Cl4r3iPb/hSe4nHkLV7qLo851pX3qtK/Hs=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20200114144118-36b2048a9120 h1:RPscN6KhmG54S33L+lr3GS+oD1jmchIU0ll519K6FA4=
k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=

View File

@ -19,6 +19,7 @@ limitations under the License.
package v1alpha1
import (
"context"
"time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -71,7 +72,7 @@ func (c *foos) Get(name string, options v1.GetOptions) (result *v1alpha1.Foo, er
Resource("foos").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Do(context.TODO()).
Into(result)
return
}
@ -88,7 +89,7 @@ func (c *foos) List(opts v1.ListOptions) (result *v1alpha1.FooList, err error) {
Resource("foos").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Do(context.TODO()).
Into(result)
return
}
@ -105,7 +106,7 @@ func (c *foos) Watch(opts v1.ListOptions) (watch.Interface, error) {
Resource("foos").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
Watch(context.TODO())
}
// Create takes the representation of a foo and creates it. Returns the server's representation of the foo, and an error, if there is any.
@ -115,7 +116,7 @@ func (c *foos) Create(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
Namespace(c.ns).
Resource("foos").
Body(foo).
Do().
Do(context.TODO()).
Into(result)
return
}
@ -128,7 +129,7 @@ func (c *foos) Update(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error) {
Resource("foos").
Name(foo.Name).
Body(foo).
Do().
Do(context.TODO()).
Into(result)
return
}
@ -144,7 +145,7 @@ func (c *foos) UpdateStatus(foo *v1alpha1.Foo) (result *v1alpha1.Foo, err error)
Name(foo.Name).
SubResource("status").
Body(foo).
Do().
Do(context.TODO()).
Into(result)
return
}
@ -156,7 +157,7 @@ func (c *foos) Delete(name string, options *v1.DeleteOptions) error {
Resource("foos").
Name(name).
Body(options).
Do().
Do(context.TODO()).
Error()
}
@ -172,7 +173,7 @@ func (c *foos) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOp
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Do(context.TODO()).
Error()
}
@ -185,7 +186,7 @@ func (c *foos) Patch(name string, pt types.PatchType, data []byte, subresources
SubResource(subresources...).
Name(name).
Body(data).
Do().
Do(context.TODO()).
Into(result)
return
}