Skip to content

feat: Allow cluster-specific QPS and Burst limit configuration for the target clusters #29001

Description

@luwangVMW

Summary

Currently, Argo CD uses a set of global environment variables (ARGOCD_K8S_CLIENT_QPS and ARGOCD_K8S_CLIENT_BURST, maps to controller.k8s.client.qps and controller.k8s.client.burst in argocd-cmd-params-cm) to configure the rate-limiting (QPS and Burst) of the Kubernetes REST clients for all managed destination clusters.
We propose introducing the ability to define cluster-specific QPS and Burst limits, allowing operators to fine-tune rate-limiting on a per-cluster basis.

Motivation

In large-scale multi-cluster environments managed by Argo CD, target clusters can vary drastically in their infrastructure capabilities, network topology, and workload density.
A "one-size-fits-all" global QPS/Burst configuration introduces several critical trade-offs:

  1. Under-provisioned/Edge Clusters: Small or edge clusters can easily be overwhelmed by the default QPS of 50 and Burst of 100 during sync operations or intense cache discovery. This leads to API Server throttling, elevated latencies, or even API server crashes.
  2. High-Performance/Scale Clusters: Large-scale enterprise clusters containing thousands of resources require high QPS/Burst limits to accelerate reconciliation, reduce Sync times, and handle rapid automatic rollouts (Auto-Sync).
  3. The "Lowest Common Denominator" Problem: Operators are currently forced to either set a very low global QPS (slowing down synchronization for high-performance clusters) or a high global QPS (risking the stability of weak edge clusters).
    Allowing granular, per-cluster overrides would solve this bottleneck, bringing better stability to fragile clusters and higher performance to massive ones.

Proposal

I propose extending the Cluster Secret configuration to allow user to specify custom QPS and Burst values. If a Cluster Secret does not define these specific values, Argo CD will seamlessly fall back to the global defaults configured in the ConfigMap (argocd-cmd-params-cm).
To implement this on the Cluster Secret, we have identified two viable options:

Option 1: Leveraging Cluster Secret metadata.annotations (Non-intrusive metadata expansion)
This approach reads the custom limits directly from the Cluster Secret's annotations, which are already automatically deserialized into the Cluster.Annotations struct by Argo CD.

apiVersion: v1
kind: Secret
metadata:
  name: edge-cluster-secret
  labels:
    argocd.argoproj.io/secret-type: cluster
  annotations:
    # Option 1: Define limits via annotations
    argocd.argoproj.io/k8s-client-qps: "10"
    argocd.argoproj.io/k8s-client-burst: "20"

Option 2: Extending Cluster Secret data.config JSON Schema (First-Class API Field)
This approach extends the ClusterConfig struct inside pkg/apis/application/v1alpha1/types.go by adding native typed fields. Since the Cluster Secret's data.config string is unmarshaled directly into ClusterConfig, this enables defining limits natively inside the Config JSON.

apiVersion: v1
kind: Secret
metadata:
  name: edge-cluster-secret
  labels:
    argocd.argoproj.io/secret-type: cluster
type: Opaque
stringData:
  name: edge-cluster
  server: https://edge-cluster.internal
  config: |
    {
      "bearerToken": "example-token",
      // Option 2: Define limits natively inside the config payload
      "qps": 10,
      "burst": 20
    }

Backward Compatibility & Fallback Mechanism (Crucial)
To guarantee 100% backward compatibility, both options will follow a strict fallback order during Kubernetes client initialization.
If neither Option 1 nor Option 2 is specified in the Cluster Secret, Argo CD will default to the global limits defined in argocd-cmd-params-cm (e.g., controller.k8s.client.qps and controller.k8s.client.burst).

I would love to get feedback from the maintainers on the preferred design option. I am also open to submitting a Pull Request for this feature once we align on the approach!

Metadata

Metadata

Assignees

No one assigned

    Labels

    component:cluster-managementIssue related to multi-clusters managementenhancementNew feature or requestproposal:requiredThe enhancement is sufficiently complex to require a former proposaltriage/pendingThis issue needs further triage to be correctly classifiedtype:scalabilityIssues related to scalability and performance related issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions