tr_quest
tr_quest

Reputation: 765

Verifying that a kubernetes pod is deleted using client-go

I am trying to ensure that a pod is deleted before proceeding with another Kubernetes Operation. So the idea I have is to Call the Pod Delete Function and then call the Pod Get Function.

// Delete Pod
err := kubeClient.CoreV1().Pods(tr.namespace).Delete(podName, &metav1.DeleteOptions{})

if err != nil {
   ....
}

pod, err := kubeClient.CoreV1().Pods(tr.namespace).Get(podName, &metav1.DeleteOptions{})

// What do I look for to confirm that the pod has been deleted?

Upvotes: 0

Views: 1785

Answers (1)

coderanger
coderanger

Reputation: 54267

err != nil && errors.IsNotFound(err)

Also this is silly and you shouldn't do it.

Upvotes: 4

Related Questions