Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions pkg/pro/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package pro

import (
"context"
"os"
"strconv"
"time"

"github.com/loft-sh/admin-apis/pkg/licenseapi"
"github.com/loft-sh/vcluster/pkg/config"
Expand All @@ -16,9 +19,30 @@ import (

var GetRemoteClient = func(vConfig *config.VirtualClusterConfig) (*rest.Config, string, string, *rest.Config, string, string, error) {
inClusterConfig := ctrl.GetConfigOrDie()
inClusterConfig.QPS = 40
inClusterConfig.Burst = 80
inClusterConfig.Timeout = 0

// Get QPS from environment variable or default to 40
qpsStr := os.Getenv("VCLUSTER_PHYSICAL_CLIENT_QPS")
qps, err := strconv.ParseFloat(qpsStr, 32)
if err != nil || qpsStr == "" {
qps = 40
}
inClusterConfig.QPS = float32(qps)

// Get Burst from environment variable or default to 80
burstStr := os.Getenv("VCLUSTER_PHYSICAL_CLIENT_BURST")
burst, err := strconv.Atoi(burstStr)
if err != nil || burstStr == "" {
burst = 80
}
inClusterConfig.Burst = burst

// Get Timeout from environment variable or default to 0
timeoutStr := os.Getenv("VCLUSTER_PHYSICAL_CLIENT_TIMEOUT")
timeout, err := strconv.Atoi(timeoutStr)
if err != nil || timeoutStr == "" {
timeout = 0
}
inClusterConfig.Timeout = time.Duration(timeout) * time.Second

// get current namespace
currentNamespace, err := clienthelper.CurrentNamespace()
Expand Down