hotfix: set get running pod timeout 10s to 5s (#494)

This commit is contained in:
naison
2025-03-30 11:43:37 +08:00
committed by GitHub
parent 4f4bbd79f2
commit fb428403a2
3 changed files with 4 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ import (
"time"
"github.com/pkg/errors"
"github.com/wencaiwulue/kubevpn/v2/pkg/config"
plog "github.com/wencaiwulue/kubevpn/v2/pkg/log"
"github.com/wencaiwulue/kubevpn/v2/pkg/util"

View File

@@ -296,8 +296,8 @@ func (c *ConnectOptions) portForward(ctx context.Context, portPair []string) err
sortBy := func(pods []*v1.Pod) sort.Interface { return sort.Reverse(podutils.ActivePods(pods)) }
label := fields.OneTermEqualSelector("app", config.ConfigMapPodTrafficManager).String()
_, _, _ = polymorphichelpers.GetFirstPod(c.clientset.CoreV1(), c.Namespace, label, time.Second*10, sortBy)
ctx2, cancelFunc2 := context.WithTimeout(ctx, time.Second*10)
_, _, _ = polymorphichelpers.GetFirstPod(c.clientset.CoreV1(), c.Namespace, label, time.Second*5, sortBy)
ctx2, cancelFunc2 := context.WithTimeout(ctx, time.Second*5)
defer cancelFunc2()
podList, err := c.GetRunningPodList(ctx2)
if err != nil {

View File

@@ -335,7 +335,7 @@ func CheckPodStatus(ctx context.Context, cancelFunc context.CancelFunc, podName
return err != nil
},
func() error {
ctx1, cancelFunc1 := context.WithTimeout(ctx, time.Second*10)
ctx1, cancelFunc1 := context.WithTimeout(ctx, time.Second*5)
defer cancelFunc1()
_, err := podInterface.Get(ctx1, podName, v1.GetOptions{})
return err