Skip to content

Commit bfc75d9

Browse files
committed
manual fixes
1 parent 1dcd1fb commit bfc75d9

File tree

5 files changed

+28
-23
lines changed

5 files changed

+28
-23
lines changed

pkg/controller/nodelifecycle/node_lifecycle_controller_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2759,7 +2759,7 @@ func TestApplyNoExecuteTaints(t *testing.T) {
27592759

27602760
// Make node3 healthy again.
27612761
node2.Status = healthyNodeNewStatus
2762-
_, err = fakeNodeHandler.UpdateStatus(context.TODO(), node2)
2762+
_, err = fakeNodeHandler.UpdateStatus(context.TODO(), node2, metav1.UpdateOptions{})
27632763
if err != nil {
27642764
t.Errorf(err.Error())
27652765
return
@@ -2905,12 +2905,12 @@ func TestSwapUnreachableNotReadyTaints(t *testing.T) {
29052905

29062906
node0.Status = newNodeStatus
29072907
node1.Status = healthyNodeNewStatus
2908-
_, err = fakeNodeHandler.UpdateStatus(context.TODO(), node0)
2908+
_, err = fakeNodeHandler.UpdateStatus(context.TODO(), node0, metav1.UpdateOptions{})
29092909
if err != nil {
29102910
t.Errorf(err.Error())
29112911
return
29122912
}
2913-
_, err = fakeNodeHandler.UpdateStatus(context.TODO(), node1)
2913+
_, err = fakeNodeHandler.UpdateStatus(context.TODO(), node1, metav1.UpdateOptions{})
29142914
if err != nil {
29152915
t.Errorf(err.Error())
29162916
return
@@ -3120,7 +3120,7 @@ func TestTaintsNodeByCondition(t *testing.T) {
31203120
}
31213121

31223122
for _, test := range tests {
3123-
fakeNodeHandler.Update(context.TODO(), test.Node)
3123+
fakeNodeHandler.Update(context.TODO(), test.Node, metav1.UpdateOptions{})
31243124
if err := nodeController.syncNodeStore(fakeNodeHandler); err != nil {
31253125
t.Errorf("unexpected error: %v", err)
31263126
}
@@ -3331,7 +3331,7 @@ func TestReconcileNodeLabels(t *testing.T) {
33313331
}
33323332

33333333
for _, test := range tests {
3334-
fakeNodeHandler.Update(context.TODO(), test.Node)
3334+
fakeNodeHandler.Update(context.TODO(), test.Node, metav1.UpdateOptions{})
33353335
if err := nodeController.syncNodeStore(fakeNodeHandler); err != nil {
33363336
t.Fatalf("unexpected error: %v", err)
33373337
}
@@ -3355,7 +3355,6 @@ func TestReconcileNodeLabels(t *testing.T) {
33553355
if actualValue != expectedValue {
33563356
t.Errorf("%s: label %q: expected value %q, got value %q", test.Name, key, expectedValue, actualValue)
33573357
}
3358-
33593358
}
33603359
}
33613360
}

pkg/controller/replication/conversion.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,16 +203,22 @@ type conversionClient struct {
203203
v1client.ReplicationControllerInterface
204204
}
205205

206-
func (c conversionClient) Create(ctx context.Context, rs *apps.ReplicaSet) (*apps.ReplicaSet, error) {
207-
return convertCall(ctx, c.ReplicationControllerInterface.Create, rs)
206+
func (c conversionClient) Create(ctx context.Context, rs *apps.ReplicaSet, opts metav1.CreateOptions) (*apps.ReplicaSet, error) {
207+
return convertCall(func(rc *v1.ReplicationController) (*v1.ReplicationController, error) {
208+
return c.ReplicationControllerInterface.Create(ctx, rc, opts)
209+
}, rs)
208210
}
209211

210-
func (c conversionClient) Update(ctx context.Context, rs *apps.ReplicaSet) (*apps.ReplicaSet, error) {
211-
return convertCall(ctx, c.ReplicationControllerInterface.Update, rs)
212+
func (c conversionClient) Update(ctx context.Context, rs *apps.ReplicaSet, opts metav1.UpdateOptions) (*apps.ReplicaSet, error) {
213+
return convertCall(func(rc *v1.ReplicationController) (*v1.ReplicationController, error) {
214+
return c.ReplicationControllerInterface.Update(ctx, rc, opts)
215+
}, rs)
212216
}
213217

214-
func (c conversionClient) UpdateStatus(ctx context.Context, rs *apps.ReplicaSet) (*apps.ReplicaSet, error) {
215-
return convertCall(ctx, c.ReplicationControllerInterface.UpdateStatus, rs)
218+
func (c conversionClient) UpdateStatus(ctx context.Context, rs *apps.ReplicaSet, opts metav1.UpdateOptions) (*apps.ReplicaSet, error) {
219+
return convertCall(func(rc *v1.ReplicationController) (*v1.ReplicationController, error) {
220+
return c.ReplicationControllerInterface.UpdateStatus(ctx, rc, opts)
221+
}, rs)
216222
}
217223

218224
func (c conversionClient) Get(ctx context.Context, name string, options metav1.GetOptions) (*apps.ReplicaSet, error) {
@@ -236,7 +242,7 @@ func (c conversionClient) Watch(ctx context.Context, opts metav1.ListOptions) (w
236242
return nil, errors.New("Watch() is not implemented for conversionClient")
237243
}
238244

239-
func (c conversionClient) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, subresources ...string) (result *apps.ReplicaSet, err error) {
245+
func (c conversionClient) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apps.ReplicaSet, err error) {
240246
// This is not used by RSC.
241247
return nil, errors.New("Patch() is not implemented for conversionClient")
242248
}
@@ -246,7 +252,7 @@ func (c conversionClient) GetScale(ctx context.Context, name string, options met
246252
return nil, errors.New("GetScale() is not implemented for conversionClient")
247253
}
248254

249-
func (c conversionClient) UpdateScale(ctx context.Context, name string, scale *autoscalingv1.Scale) (result *autoscalingv1.Scale, err error) {
255+
func (c conversionClient) UpdateScale(ctx context.Context, name string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
250256
// This is not used by RSC.
251257
return nil, errors.New("UpdateScale() is not implemented for conversionClient")
252258
}
@@ -275,12 +281,12 @@ func convertList(rcList *v1.ReplicationControllerList) (*apps.ReplicaSetList, er
275281
return rsList, nil
276282
}
277283

278-
func convertCall(ctx context.Context, fn func(context.Context, *v1.ReplicationController) (*v1.ReplicationController, error), rs *apps.ReplicaSet) (*apps.ReplicaSet, error) {
284+
func convertCall(fn func(*v1.ReplicationController) (*v1.ReplicationController, error), rs *apps.ReplicaSet) (*apps.ReplicaSet, error) {
279285
rc, err := convertRStoRC(rs)
280286
if err != nil {
281287
return nil, err
282288
}
283-
result, err := fn(ctx, rc)
289+
result, err := fn(rc)
284290
if err != nil {
285291
return nil, err
286292
}

pkg/controller/testutil/test_utils.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (m *FakeLegacyHandler) Nodes() v1core.NodeInterface {
111111
}
112112

113113
// Create adds a new Node to the fake store.
114-
func (m *FakeNodeHandler) Create(_ context.Context, node *v1.Node) (*v1.Node, error) {
114+
func (m *FakeNodeHandler) Create(_ context.Context, node *v1.Node, _ metav1.CreateOptions) (*v1.Node, error) {
115115
m.lock.Lock()
116116
defer func() {
117117
m.RequestCount++
@@ -202,7 +202,7 @@ func (m *FakeNodeHandler) DeleteCollection(_ context.Context, opt *metav1.Delete
202202
}
203203

204204
// Update updates a Node in the fake store.
205-
func (m *FakeNodeHandler) Update(_ context.Context, node *v1.Node) (*v1.Node, error) {
205+
func (m *FakeNodeHandler) Update(_ context.Context, node *v1.Node, _ metav1.UpdateOptions) (*v1.Node, error) {
206206
m.lock.Lock()
207207
defer func() {
208208
m.RequestCount++
@@ -221,7 +221,7 @@ func (m *FakeNodeHandler) Update(_ context.Context, node *v1.Node) (*v1.Node, er
221221
}
222222

223223
// UpdateStatus updates a status of a Node in the fake store.
224-
func (m *FakeNodeHandler) UpdateStatus(_ context.Context, node *v1.Node) (*v1.Node, error) {
224+
func (m *FakeNodeHandler) UpdateStatus(_ context.Context, node *v1.Node, _ metav1.UpdateOptions) (*v1.Node, error) {
225225
m.lock.Lock()
226226
defer func() {
227227
m.RequestCount++
@@ -266,7 +266,7 @@ func (m *FakeNodeHandler) UpdateStatus(_ context.Context, node *v1.Node) (*v1.No
266266
// PatchStatus patches a status of a Node in the fake store.
267267
func (m *FakeNodeHandler) PatchStatus(ctx context.Context, nodeName string, data []byte) (*v1.Node, error) {
268268
m.RequestCount++
269-
return m.Patch(ctx, nodeName, types.StrategicMergePatchType, data, "status")
269+
return m.Patch(ctx, nodeName, types.StrategicMergePatchType, data, metav1.PatchOptions{}, "status")
270270
}
271271

272272
// Watch watches Nodes in a fake store.
@@ -275,7 +275,7 @@ func (m *FakeNodeHandler) Watch(_ context.Context, opts metav1.ListOptions) (wat
275275
}
276276

277277
// Patch patches a Node in the fake store.
278-
func (m *FakeNodeHandler) Patch(_ context.Context, name string, pt types.PatchType, data []byte, subresources ...string) (*v1.Node, error) {
278+
func (m *FakeNodeHandler) Patch(_ context.Context, name string, pt types.PatchType, data []byte, _ metav1.PatchOptions, subresources ...string) (*v1.Node, error) {
279279
m.lock.Lock()
280280
defer func() {
281281
m.RequestCount++

pkg/kubelet/certificate/bootstrap/bootstrap_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ type fakeClient struct {
148148
failureType failureType
149149
}
150150

151-
func (c *fakeClient) Create(context.Context, *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error) {
151+
func (c *fakeClient) Create(context.Context, *certificates.CertificateSigningRequest, metav1.CreateOptions) (*certificates.CertificateSigningRequest, error) {
152152
if c.failureType == createError {
153153
return nil, fmt.Errorf("fakeClient failed creating request")
154154
}

staging/src/k8s.io/client-go/util/certificate/certificate_manager_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ func (c fakeClient) List(_ context.Context, opts v1.ListOptions) (*certificates.
10121012
return &csrReply, nil
10131013
}
10141014

1015-
func (c fakeClient) Create(context.Context, *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error) {
1015+
func (c fakeClient) Create(context.Context, *certificates.CertificateSigningRequest, v1.CreateOptions) (*certificates.CertificateSigningRequest, error) {
10161016
if c.failureType == createError {
10171017
if c.err != nil {
10181018
return nil, c.err

0 commit comments

Comments
 (0)