Skip to content

Commit 5dba097

Browse files
authored
add timeout for killing pods when stopping (#290)
Signed-off-by: haorenfsa <shaoyue.chen@zilliz.com>
1 parent dae3547 commit 5dba097

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/controllers/component_condition.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package controllers
33
import (
44
"context"
55
"fmt"
6+
"time"
67

78
"github.com/milvus-io/milvus-operator/apis/milvus.io/v1beta1"
89
"github.com/milvus-io/milvus-operator/pkg/util/rest"
@@ -239,6 +240,9 @@ func ExecKillIfTerminating(ctx context.Context, podList *corev1.PodList) error {
239240
// we use kubectl exec to kill milvus process, because tini ignore SIGKILL
240241
cli := rest.GetRestClient()
241242
var ret error
243+
const killTimeout = 30 * time.Second
244+
ctx, cancel := context.WithTimeout(ctx, killTimeout)
245+
defer cancel()
242246
for _, pod := range podList.Items {
243247
if pod.DeletionTimestamp == nil {
244248
continue

0 commit comments

Comments
 (0)