Skip to content

Commit

Permalink
fix: add timeout for SPDY executor stream
Browse files Browse the repository at this point in the history
Signed-off-by: Yuping Fan <coderfyp@gmail.com>
  • Loading branch information
Yuping Fan committed May 6, 2024
1 parent 6182386 commit ae347d4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions workflow/signal/signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/argoproj/argo-workflows/v3/util/env"
"path/filepath"
"strings"
"syscall"
"time"

log "github.com/sirupsen/logrus"
corev1 "k8s.io/api/core/v1"
Expand All @@ -15,6 +17,8 @@ import (
"github.com/argoproj/argo-workflows/v3/workflow/common"
)

var spdyTimeout = env.LookupEnvDurationOr("SPDY_TIMEOUT", 10*time.Minute)

func SignalContainer(ctx context.Context, restConfig *rest.Config, pod *corev1.Pod, container string, s syscall.Signal) error {
command := []string{"/bin/sh", "-c", "kill -%d 1"}

Expand Down Expand Up @@ -49,6 +53,8 @@ func ExecPodContainerAndGetOutput(ctx context.Context, restConfig *rest.Config,
if err != nil {
return err
}
ctx, cancel := context.WithTimeout(ctx, spdyTimeout)
defer cancel()
stdout, stderr, err := common.GetExecutorOutput(ctx, x)
log.
WithField("namespace", namespace).
Expand Down

0 comments on commit ae347d4

Please sign in to comment.