Skip to content

deleteNamespacedJob with propagationPolicy as 'Foreground' does not delete pods created by the job #2698

@rnarayan-perforce

Description

@rnarayan-perforce

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions