Skip to content

Commit

Permalink
[YUNIKORN-2817] Pods should be deleted immediately when they are plac…
Browse files Browse the repository at this point in the history
…eholder pods
  • Loading branch information
zhuqi-lucas committed Aug 18, 2024
1 parent 2278b32 commit 69736c7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/client/kubeclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package client
import (
"context"
"fmt"
"github.com/apache/yunikorn-k8shim/pkg/common/utils"

"go.uber.org/zap"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -139,6 +140,9 @@ func (nc SchedulerKubeClient) Create(pod *v1.Pod) (*v1.Pod, error) {

func (nc SchedulerKubeClient) Delete(pod *v1.Pod) error {
gracefulSeconds := int64(3)
if utils.GetPlaceholderFlagFromPodSpec(pod) {
gracefulSeconds = int64(0)
}
if err := nc.clientSet.CoreV1().Pods(pod.Namespace).Delete(context.Background(), pod.Name, apis.DeleteOptions{
GracePeriodSeconds: &gracefulSeconds,
}); err != nil {
Expand Down

0 comments on commit 69736c7

Please sign in to comment.