Skip to content

Commit b60e01f

Browse files
authored
Merge pull request kubernetes#126838 from zou2699/fix-126836
fix: use the getContext() method for evicting pods
2 parents 563ab1b + cc244e8 commit b60e01f

File tree

1 file changed

+2
-2
lines changed
  • staging/src/k8s.io/kubectl/pkg/drain

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (d *Helper) EvictPod(pod corev1.Pod, evictionGroupVersion schema.GroupVersi
159159
},
160160
DeleteOptions: &delOpts,
161161
}
162-
return d.Client.PolicyV1().Evictions(eviction.Namespace).Evict(context.TODO(), eviction)
162+
return d.Client.PolicyV1().Evictions(eviction.Namespace).Evict(d.getContext(), eviction)
163163

164164
default:
165165
// otherwise, fall back to policy/v1beta1, supported by all servers that support the eviction subresource
@@ -170,7 +170,7 @@ func (d *Helper) EvictPod(pod corev1.Pod, evictionGroupVersion schema.GroupVersi
170170
},
171171
DeleteOptions: &delOpts,
172172
}
173-
return d.Client.PolicyV1beta1().Evictions(eviction.Namespace).Evict(context.TODO(), eviction)
173+
return d.Client.PolicyV1beta1().Evictions(eviction.Namespace).Evict(d.getContext(), eviction)
174174
}
175175
}
176176

0 commit comments

Comments
 (0)