Skip to content

Commit

Permalink
fix: add retry for kill pod
Browse files Browse the repository at this point in the history
Signed-off-by: henrywangx <[email protected]>
  • Loading branch information
henrywangx committed Dec 20, 2021
1 parent abf2dd5 commit 5dc8b6d
Show file tree
Hide file tree
Showing 3 changed files with 356 additions and 6 deletions.
20 changes: 19 additions & 1 deletion cmd/argoexec/commands/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ import (
"context"
"time"

errorsutil "github.com/argoproj/argo-workflows/v3/util/errors"
"github.com/argoproj/pkg/stats"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/util/wait"

"github.com/argoproj/argo-workflows/v3/workflow/executor"
)

func NewWaitCommand() *cobra.Command {
Expand All @@ -31,7 +35,21 @@ func waitContainer(ctx context.Context) error {
stats.StartStatsTicker(5 * time.Minute)

defer func() {
if err := wfExecutor.KillSidecars(ctx); err != nil {
// Killing sidecar containers
retryCnt := 0
err := wait.ExponentialBackoff(executor.ExecutorRetry, func() (bool, error) {
err := wfExecutor.KillSidecars(ctx)
if err == nil {
return true, nil
}
if errorsutil.IsTransientErr(err) {
log.WithError(err).WithField("retryCnt", retryCnt).Warn("fail to kill sidecar")
retryCnt++
return false, nil
}
return false, err
})
if err != nil {
wfExecutor.AddError(err)
}
}()
Expand Down
Loading

0 comments on commit 5dc8b6d

Please sign in to comment.