Skip to content

Commit d8abacb

Browse files
committed
client-go: update expansions callers
1 parent 4c03427 commit d8abacb

File tree

14 files changed

+25
-23
lines changed

14 files changed

+25
-23
lines changed

pkg/controller/certificates/approver/sarapprove.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func (a *sarApprover) handle(csr *capi.CertificateSigningRequest) error {
100100
}
101101
if approved {
102102
appendApprovalCondition(csr, r.successMessage)
103-
_, err = a.client.CertificatesV1beta1().CertificateSigningRequests().UpdateApproval(csr)
103+
_, err = a.client.CertificatesV1beta1().CertificateSigningRequests().UpdateApproval(context.Background(), csr, metav1.UpdateOptions{})
104104
if err != nil {
105105
return fmt.Errorf("error updating approval for csr: %v", err)
106106
}

pkg/controller/certificates/certificate_controller_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package certificates
1818

1919
import (
20+
"context"
2021
"testing"
2122
"time"
2223

@@ -47,7 +48,7 @@ func TestCertificateController(t *testing.T) {
4748
Reason: "test reason",
4849
Message: "test message",
4950
})
50-
_, err := client.CertificatesV1beta1().CertificateSigningRequests().UpdateApproval(csr)
51+
_, err := client.CertificatesV1beta1().CertificateSigningRequests().UpdateApproval(context.TODO(), csr, metav1.UpdateOptions{})
5152
if err != nil {
5253
return err
5354
}

pkg/controller/namespace/deletion/namespaced_resources_deleter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ func (d *namespacedResourcesDeleter) finalizeNamespace(namespace *v1.Namespace)
292292
for _, value := range finalizerSet.List() {
293293
namespaceFinalize.Spec.Finalizers = append(namespaceFinalize.Spec.Finalizers, v1.FinalizerName(value))
294294
}
295-
namespace, err := d.nsClient.Finalize(&namespaceFinalize)
295+
namespace, err := d.nsClient.Finalize(context.Background(), &namespaceFinalize, metav1.UpdateOptions{})
296296
if err != nil {
297297
// it was removed already, so life is good
298298
if errors.IsNotFound(err) {

pkg/scheduler/framework/plugins/defaultbinder/default_binder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (b DefaultBinder) Bind(ctx context.Context, state *framework.CycleState, p
5353
ObjectMeta: metav1.ObjectMeta{Namespace: p.Namespace, Name: p.Name, UID: p.UID},
5454
Target: v1.ObjectReference{Kind: "Node", Name: nodeName},
5555
}
56-
err := b.handle.ClientSet().CoreV1().Pods(binding.Namespace).Bind(binding)
56+
err := b.handle.ClientSet().CoreV1().Pods(binding.Namespace).Bind(context.TODO(), binding, metav1.CreateOptions{})
5757
if err != nil {
5858
return framework.NewStatus(framework.Error, err.Error())
5959
}

staging/src/k8s.io/kubectl/pkg/cmd/certificates/certificates.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package certificates
1818

1919
import (
20+
"context"
2021
"fmt"
2122
"io"
2223

@@ -234,7 +235,7 @@ func (o *CertificateOptions) modifyCertificateCondition(builder *resource.Builde
234235
csr := info.Object.(*certificatesv1beta1.CertificateSigningRequest)
235236
csr, hasCondition := modify(csr)
236237
if !hasCondition || force {
237-
_, err = clientSet.CertificateSigningRequests().UpdateApproval(csr)
238+
_, err = clientSet.CertificateSigningRequests().UpdateApproval(context.TODO(), csr, metav1.UpdateOptions{})
238239
if errors.IsConflict(err) && i < 10 {
239240
if err := info.Get(); err != nil {
240241
return err

staging/src/k8s.io/kubectl/pkg/drain/drain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func (d *Helper) EvictPod(pod corev1.Pod, policyGroupVersion string) error {
165165
}
166166

167167
// Remember to change change the URL manipulation func when Eviction's version change
168-
return d.Client.PolicyV1beta1().Evictions(eviction.Namespace).Evict(eviction)
168+
return d.Client.PolicyV1beta1().Evictions(eviction.Namespace).Evict(context.TODO(), eviction)
169169
}
170170

171171
// GetPodsForDeletion receives resource info for a node, and returns those pods as PodDeleteList,

test/e2e/apps/disruption.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ var _ = SIGDescribe("DisruptionController", func() {
246246
}
247247

248248
if c.shouldDeny {
249-
err = cs.CoreV1().Pods(ns).Evict(e)
249+
err = cs.CoreV1().Pods(ns).Evict(context.TODO(), e)
250250
gomega.Expect(err).Should(gomega.MatchError("Cannot evict pod as it would violate the pod's disruption budget."))
251251
} else {
252252
// Only wait for running pods in the "allow" case
@@ -257,7 +257,7 @@ var _ = SIGDescribe("DisruptionController", func() {
257257
// Since disruptionAllowed starts out false, if an eviction is ever allowed,
258258
// that means the controller is working.
259259
err = wait.PollImmediate(framework.Poll, timeout, func() (bool, error) {
260-
err = cs.CoreV1().Pods(ns).Evict(e)
260+
err = cs.CoreV1().Pods(ns).Evict(context.TODO(), e)
261261
if err != nil {
262262
return false, nil
263263
}
@@ -284,7 +284,7 @@ var _ = SIGDescribe("DisruptionController", func() {
284284
Namespace: ns,
285285
},
286286
}
287-
err = cs.CoreV1().Pods(ns).Evict(e)
287+
err = cs.CoreV1().Pods(ns).Evict(context.TODO(), e)
288288
gomega.Expect(err).Should(gomega.MatchError("Cannot evict pod as it would violate the pod's disruption budget."))
289289

290290
ginkgo.By("Updating the pdb to allow a pod to be evicted")
@@ -297,7 +297,7 @@ var _ = SIGDescribe("DisruptionController", func() {
297297
ginkgo.By("Trying to evict the same pod we tried earlier which should now be evictable")
298298
waitForPodsOrDie(cs, ns, 3)
299299
waitForPdbToObserveHealthyPods(cs, ns, 3)
300-
err = cs.CoreV1().Pods(ns).Evict(e)
300+
err = cs.CoreV1().Pods(ns).Evict(context.TODO(), e)
301301
framework.ExpectNoError(err) // the eviction is now allowed
302302

303303
ginkgo.By("Patching the pdb to disallow a pod to be evicted")
@@ -319,15 +319,15 @@ var _ = SIGDescribe("DisruptionController", func() {
319319
Namespace: ns,
320320
},
321321
}
322-
err = cs.CoreV1().Pods(ns).Evict(e)
322+
err = cs.CoreV1().Pods(ns).Evict(context.TODO(), e)
323323
gomega.Expect(err).Should(gomega.MatchError("Cannot evict pod as it would violate the pod's disruption budget."))
324324

325325
ginkgo.By("Deleting the pdb to allow a pod to be evicted")
326326
deletePDBOrDie(cs, ns, defaultName)
327327

328328
ginkgo.By("Trying to evict the same pod we tried earlier which should now be evictable")
329329
waitForPodsOrDie(cs, ns, 3)
330-
err = cs.CoreV1().Pods(ns).Evict(e)
330+
err = cs.CoreV1().Pods(ns).Evict(context.TODO(), e)
331331
framework.ExpectNoError(err) // the eviction is now allowed
332332
})
333333

test/e2e/auth/certificates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ var _ = SIGDescribe("Certificates API", func() {
8282
Message: "Set from an e2e test",
8383
},
8484
}
85-
csr, err = csrs.UpdateApproval(csr)
85+
csr, err = csrs.UpdateApproval(context.TODO(), csr, metav1.UpdateOptions{})
8686
if err != nil {
8787
csr, _ = csrs.Get(context.TODO(), csrName, metav1.GetOptions{})
8888
framework.Logf("err updating approval: %v", err)

test/e2e/storage/pd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ var _ = utils.SIGDescribe("Pod Disks", func() {
430430
}
431431
ginkgo.By("evicting host0Pod")
432432
err = wait.PollImmediate(framework.Poll, podEvictTimeout, func() (bool, error) {
433-
if err := cs.CoreV1().Pods(ns).Evict(evictTarget); err != nil {
433+
if err := cs.CoreV1().Pods(ns).Evict(context.TODO(), evictTarget); err != nil {
434434
framework.Logf("Failed to evict host0Pod, ignoring error: %v", err)
435435
return false, nil
436436
}

test/integration/auth/node_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ func TestNodeAuthorizer(t *testing.T) {
295295
createNode2NormalPodEviction := func(client clientset.Interface) func() error {
296296
return func() error {
297297
zero := int64(0)
298-
return client.PolicyV1beta1().Evictions("ns").Evict(&policy.Eviction{
298+
return client.PolicyV1beta1().Evictions("ns").Evict(context.TODO(), &policy.Eviction{
299299
TypeMeta: metav1.TypeMeta{
300300
APIVersion: "policy/v1beta1",
301301
Kind: "Eviction",
@@ -311,7 +311,7 @@ func TestNodeAuthorizer(t *testing.T) {
311311
createNode2MirrorPodEviction := func(client clientset.Interface) func() error {
312312
return func() error {
313313
zero := int64(0)
314-
return client.PolicyV1beta1().Evictions("ns").Evict(&policy.Eviction{
314+
return client.PolicyV1beta1().Evictions("ns").Evict(context.TODO(), &policy.Eviction{
315315
TypeMeta: metav1.TypeMeta{
316316
APIVersion: "policy/v1beta1",
317317
Kind: "Eviction",

0 commit comments

Comments
 (0)