Describe the bug
deleteNamespacedJob with propagationPolicy as 'Foreground' does not delete pods created by the job
await this.kubernetesBatchApi.deleteNamespacedJob({
name: "job-name",
namespace: "namespace",
body: {},
gracePeriodSeconds: 60,
propagationPolicy: 'Foreground'
});
Client Version
e.g. 1.1.2, 1.4.0 & 1.3.0
Server Version
e.g. 1.32
To Reproduce
Call deleteNamespacedJob with a job name and use the following commands on two different terminals to list the jobs and the pod:
watch kubectl get jobs -n namespace
watch kubectl get pods -n namespace
The job gets deleted but the pod continues to run.
Expected behavior
Since we are using Foreground propagationPolicy, the pods should get deleted first and then the job. In this case the pod does not get deleted at all.
Example Code
await this.kubernetesBatchApi.deleteNamespacedJob({
name: "job-name",
namespace: "namespace",
body: {},
gracePeriodSeconds: 60,
propagationPolicy: 'Foreground'
});
Environment (please complete the following information):
- OS: LINUX
- Node.js version 22
- Cloud runtime: AWS EKS