Deleting a job with client-go

6/8/2019

Does anyone have any examples of how to delete k8s jobs using client-go? I've tried the following which deletes the job but leaves the pods behind:

fg := metav1.DeletePropagationBackground
deleteOptions := metav1.DeleteOptions{PropagationPolicy: &fg}

if err := clientset.BatchV1().Jobs("default").Delete("example-job", &deleteOptions); err != nil {
    fmt.Printf(err)
}

I've tried using the DeletePropagationForeground option, but that resulted in nothing being deleted.

-- jamese
go
kubernetes

0 Answers