fix: use the getContext() method for evicting pods

This commit is contained in:
tux 2024-08-21 14:08:57 +08:00
parent beb696c2c9
commit cc244e8d1d

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)
}
}