mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Revert "e2epod: use foreground deletion"
This reverts commit af91e76d
"e2epod: use foreground deletion"
and fixes node-kubelet-conformance tests.
This commit is contained in:
parent
de18bd6c89
commit
6a40cc90e9
@ -48,7 +48,7 @@ func DeletePodOrFail(c clientset.Interface, ns, name string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DeletePodWithWait deletes the passed-in pod and waits for the pod to be terminated. Resilient to the pod
|
// DeletePodWithWait deletes the passed-in pod and waits for the pod to be terminated. Resilient to the pod
|
||||||
// not existing. Also waits for all owned resources to be deleted.
|
// not existing.
|
||||||
func DeletePodWithWait(c clientset.Interface, pod *v1.Pod) error {
|
func DeletePodWithWait(c clientset.Interface, pod *v1.Pod) error {
|
||||||
if pod == nil {
|
if pod == nil {
|
||||||
return nil
|
return nil
|
||||||
@ -57,17 +57,10 @@ func DeletePodWithWait(c clientset.Interface, pod *v1.Pod) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DeletePodWithWaitByName deletes the named and namespaced pod and waits for the pod to be terminated. Resilient to the pod
|
// DeletePodWithWaitByName deletes the named and namespaced pod and waits for the pod to be terminated. Resilient to the pod
|
||||||
// not existing. Also waits for all owned resources to be deleted.
|
// not existing.
|
||||||
func DeletePodWithWaitByName(c clientset.Interface, podName, podNamespace string) error {
|
func DeletePodWithWaitByName(c clientset.Interface, podName, podNamespace string) error {
|
||||||
e2elog.Logf("Deleting pod %q in namespace %q", podName, podNamespace)
|
e2elog.Logf("Deleting pod %q in namespace %q", podName, podNamespace)
|
||||||
deletionPolicy := metav1.DeletePropagationForeground
|
err := c.CoreV1().Pods(podNamespace).Delete(context.TODO(), podName, metav1.DeleteOptions{})
|
||||||
err := c.CoreV1().Pods(podNamespace).Delete(context.TODO(), podName,
|
|
||||||
metav1.DeleteOptions{
|
|
||||||
// If the pod is the owner of some resources (like ephemeral inline volumes),
|
|
||||||
// then we want to be sure that those are also gone before we return.
|
|
||||||
// Blocking pod deletion via metav1.DeletePropagationForeground achieves that.
|
|
||||||
PropagationPolicy: &deletionPolicy,
|
|
||||||
})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if apierrors.IsNotFound(err) {
|
if apierrors.IsNotFound(err) {
|
||||||
return nil // assume pod was already deleted
|
return nil // assume pod was already deleted
|
||||||
|
Loading…
Reference in New Issue
Block a user