diff --git a/go.mod b/go.mod index f996fe1f..b294861d 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/onsi/gomega v1.44.0 github.com/opencontainers/image-spec v1.1.1 github.com/pkg/errors v0.9.1 - github.com/projectsveltos/libsveltos v1.17.0 + github.com/projectsveltos/libsveltos v1.17.1-0.20261101135809-65798348bae6 github.com/prometheus/client_golang v1.25.0 github.com/sigstore/cosign/v3 v3.1.4 github.com/sigstore/sigstore v1.11.2 diff --git a/go.sum b/go.sum index eab8692d..77f3acf6 100644 --- a/go.sum +++ b/go.sum @@ -645,8 +645,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/poy/onpar v1.1.2 h1:QaNrNiZx0+Nar5dLgTVp5mXkyoVFIbepjyEoGSnhbAY= github.com/poy/onpar v1.1.2/go.mod h1:6X8FLNoxyr9kkmnlqpK6LSoiOtrO6MICtWwEuWkLjzg= -github.com/projectsveltos/libsveltos v1.17.0 h1:7oIvY+bg9oLRYm8wlyZypYVvCcMspYl/FT9VG8XvQG0= -github.com/projectsveltos/libsveltos v1.17.0/go.mod h1:dHJrl1V5/WrNda5wzxbHs2dlsvoV/FUlwK1TXy2X3pA= +github.com/projectsveltos/libsveltos v1.17.1-0.20261101135809-65798348bae6 h1:lwfrK/ZH9Ee2YAcEdbS0T18QMp/ea7BvEt967oKQnu4= +github.com/projectsveltos/libsveltos v1.17.1-0.20261101135809-65798348bae6/go.mod h1:dHJrl1V5/WrNda5wzxbHs2dlsvoV/FUlwK1TXy2X3pA= github.com/projectsveltos/lua-utils/glua-json v0.0.0-20251212200258-2b3cdcb7c0f5 h1:khnc+994UszxZYu69J+R5FKiLA/Nk1JQj0EYAkwTWz0= github.com/projectsveltos/lua-utils/glua-json v0.0.0-20251212200258-2b3cdcb7c0f5/go.mod h1:yVL8KQFa9tmcxgwl9nwIMtKgtmIVC1zaFRSCfOwYvPY= github.com/projectsveltos/lua-utils/glua-runes v0.0.0-20251212200258-2b3cdcb7c0f5 h1:YbsebwRwTRhV8QacvEAdFqxcxHdeu7JTVtsBovbkgos= diff --git a/pkg/app/app.go b/pkg/app/app.go index 4a55c474..854ff25b 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -67,6 +67,7 @@ import ( "github.com/projectsveltos/addon-controller/controllers/dependencymanager" "github.com/projectsveltos/addon-controller/internal/telemetry" libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" + "github.com/projectsveltos/libsveltos/lib/clusterproxy" "github.com/projectsveltos/libsveltos/lib/crd" "github.com/projectsveltos/libsveltos/lib/deployer" logs "github.com/projectsveltos/libsveltos/lib/logsettings" @@ -86,6 +87,8 @@ var ( tmpReportMode int restConfigQPS float32 restConfigBurst int + managedClusterQPS float32 + managedClusterBurst int webhookPort int syncPeriod time.Duration conflictRetryTime time.Duration @@ -137,6 +140,7 @@ func Run() { ctrlOptions := getCtrlOptions(scheme) restConfig := getRestConfig() + clusterproxy.SetRestConfigLimits(managedClusterQPS, managedClusterBurst) ctx := ctrl.SetupSignalHandler() @@ -282,15 +286,25 @@ func initFlags(fs *pflag.FlagSet) { fs.StringVar(®istry, "registry", "", "Container registry for drift-detection images. Defaults to docker.io/ if empty.") - const defautlRestConfigQPS = 20 + const defautlRestConfigQPS = 40 fs.Float32Var(&restConfigQPS, "kube-api-qps", defautlRestConfigQPS, - fmt.Sprintf("Maximum queries per second from the controller client to the Kubernetes API server. Defaults to %d", - defautlRestConfigQPS)) + fmt.Sprintf("Maximum queries per second from the controller client to the management cluster Kubernetes API server. "+ + "Defaults to %d", defautlRestConfigQPS)) - const defaultRestConfigBurst = 60 + const defaultRestConfigBurst = 120 fs.IntVar(&restConfigBurst, "kube-api-burst", defaultRestConfigBurst, - fmt.Sprintf("Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server. Default %d", - defaultRestConfigBurst)) + fmt.Sprintf("Maximum number of queries that should be allowed in one burst from the controller client to the "+ + "management cluster Kubernetes API server. Default %d", defaultRestConfigBurst)) + + const defaultManagedClusterRestConfigQPS = 20 + fs.Float32Var(&managedClusterQPS, "managed-cluster-kube-api-qps", defaultManagedClusterRestConfigQPS, + fmt.Sprintf("Maximum queries per second from the controller client to the Kubernetes API server of each managed cluster. "+ + "Defaults to %d", defaultManagedClusterRestConfigQPS)) + + const defaultManagedClusterRestConfigBurst = 60 + fs.IntVar(&managedClusterBurst, "managed-cluster-kube-api-burst", defaultManagedClusterRestConfigBurst, + fmt.Sprintf("Maximum number of queries that should be allowed in one burst from the controller client to the "+ + "Kubernetes API server of each managed cluster. Default %d", defaultManagedClusterRestConfigBurst)) const defaultWebhookPort = 9443 fs.IntVar(&webhookPort, "webhook-port", defaultWebhookPort,