From 6b3a79f9fc224465b2b210e45b46f2d2b6c709f6 Mon Sep 17 00:00:00 2001 From: Mike Danese Date: Tue, 17 Dec 2019 00:01:53 -0800 Subject: [PATCH] some manual fixes Kubernetes-commit: 26377722982a8489d2a974db88e7478e54e4eaf0 --- kubernetes/typed/core/v1/event_expansion.go | 2 +- kubernetes/typed/core/v1/fake/fake_node_expansion.go | 6 ++++-- kubernetes/typed/core/v1/node_expansion.go | 6 +++--- util/certificate/certificate_manager_test.go | 7 ++++--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/kubernetes/typed/core/v1/event_expansion.go b/kubernetes/typed/core/v1/event_expansion.go index 7377ef5d..211cf060 100644 --- a/kubernetes/typed/core/v1/event_expansion.go +++ b/kubernetes/typed/core/v1/event_expansion.go @@ -119,7 +119,7 @@ func (e *events) Search(scheme *runtime.Scheme, objOrRef runtime.Object) (*v1.Ev refUID = &stringRefUID } fieldSelector := e.GetFieldSelector(&ref.Name, &ref.Namespace, refKind, refUID) - return e.List(metav1.ListOptions{FieldSelector: fieldSelector.String()}) + return e.List(context.TODO(), metav1.ListOptions{FieldSelector: fieldSelector.String()}) } // Returns the appropriate field selector based on the API version being used to communicate with the server. diff --git a/kubernetes/typed/core/v1/fake/fake_node_expansion.go b/kubernetes/typed/core/v1/fake/fake_node_expansion.go index a39022c8..eccf9fec 100644 --- a/kubernetes/typed/core/v1/fake/fake_node_expansion.go +++ b/kubernetes/typed/core/v1/fake/fake_node_expansion.go @@ -17,13 +17,15 @@ limitations under the License. package fake import ( - "k8s.io/api/core/v1" + "context" + + v1 "k8s.io/api/core/v1" types "k8s.io/apimachinery/pkg/types" core "k8s.io/client-go/testing" ) // TODO: Should take a PatchType as an argument probably. -func (c *FakeNodes) PatchStatus(nodeName string, data []byte) (*v1.Node, error) { +func (c *FakeNodes) PatchStatus(_ context.Context, nodeName string, data []byte) (*v1.Node, error) { // TODO: Should be configurable to support additional patch strategies. pt := types.StrategicMergePatchType obj, err := c.Fake.Invokes( diff --git a/kubernetes/typed/core/v1/node_expansion.go b/kubernetes/typed/core/v1/node_expansion.go index 1df46ed5..bdf7bfed 100644 --- a/kubernetes/typed/core/v1/node_expansion.go +++ b/kubernetes/typed/core/v1/node_expansion.go @@ -27,19 +27,19 @@ import ( type NodeExpansion interface { // PatchStatus modifies the status of an existing node. It returns the copy // of the node that the server returns, or an error. - PatchStatus(nodeName string, data []byte) (*v1.Node, error) + PatchStatus(ctx context.Context, nodeName string, data []byte) (*v1.Node, error) } // PatchStatus modifies the status of an existing node. It returns the copy of // the node that the server returns, or an error. -func (c *nodes) PatchStatus(nodeName string, data []byte) (*v1.Node, error) { +func (c *nodes) PatchStatus(ctx context.Context, nodeName string, data []byte) (*v1.Node, error) { result := &v1.Node{} err := c.client.Patch(types.StrategicMergePatchType). Resource("nodes"). Name(nodeName). SubResource("status"). Body(data). - Do(context.TODO()). + Do(ctx). Into(result) return result, err } diff --git a/util/certificate/certificate_manager_test.go b/util/certificate/certificate_manager_test.go index 96650adc..b68b7b60 100644 --- a/util/certificate/certificate_manager_test.go +++ b/util/certificate/certificate_manager_test.go @@ -18,6 +18,7 @@ package certificate import ( "bytes" + "context" "crypto/tls" "crypto/x509" "crypto/x509/pkix" @@ -996,7 +997,7 @@ type fakeClient struct { err error } -func (c fakeClient) List(opts v1.ListOptions) (*certificates.CertificateSigningRequestList, error) { +func (c fakeClient) List(_ context.Context, opts v1.ListOptions) (*certificates.CertificateSigningRequestList, error) { if c.failureType == watchError { if c.err != nil { return nil, c.err @@ -1011,7 +1012,7 @@ func (c fakeClient) List(opts v1.ListOptions) (*certificates.CertificateSigningR return &csrReply, nil } -func (c fakeClient) Create(*certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error) { +func (c fakeClient) Create(context.Context, *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error) { if c.failureType == createError { if c.err != nil { return nil, c.err @@ -1023,7 +1024,7 @@ func (c fakeClient) Create(*certificates.CertificateSigningRequest) (*certificat return &csrReply, nil } -func (c fakeClient) Watch(opts v1.ListOptions) (watch.Interface, error) { +func (c fakeClient) Watch(_ context.Context, opts v1.ListOptions) (watch.Interface, error) { if c.failureType == watchError { if c.err != nil { return nil, c.err