Merge pull request #126838 from zou2699/fix-126836

fix: use the getContext() method for evicting pods
This commit is contained in:
Kubernetes Prow Robot 2024-08-21 18:32:19 +01:00 committed by GitHub
commit b60e01f881
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -159,7 +159,7 @@ func (d *Helper) EvictPod(pod corev1.Pod, evictionGroupVersion schema.GroupVersi
},
DeleteOptions: &delOpts,
}
return d.Client.PolicyV1().Evictions(eviction.Namespace).Evict(context.TODO(), eviction)
return d.Client.PolicyV1().Evictions(eviction.Namespace).Evict(d.getContext(), eviction)
default:
// 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
},
DeleteOptions: &delOpts,
}
return d.Client.PolicyV1beta1().Evictions(eviction.Namespace).Evict(context.TODO(), eviction)
return d.Client.PolicyV1beta1().Evictions(eviction.Namespace).Evict(d.getContext(), eviction)
}
}