// Delete a Batch Job by name
func (k K8sClient) DeleteBatchJob(name string, namespace string) error {
return k.K8sCS.BatchV1().Jobs(namespace).Delete(context.TODO(), name, metav1.DeleteOptions{})
}
I am deleting a job if already exists and then starting a new Job, but the operation here is asynchronous and job creation phase started when the job is being deleted, which I don't want. I want to successfully delete a job before creation of new one.
How can I implement this functionality using go?