← Back to Pull requests

Add kube-api-qps and kube-api-burst flags to cdi-controller and cdi-apiserver #4325

Open
unknown opened this pull request with 341 lines diff across 4 files
View on GitHub
unknown unknown commented on Oct 26, 2026 01:32 UTC
Author

What this PR does / why we need it:

I was cloning a lot of DataVolumes at once and it was way slower than it should be. A single CSI clone takes about a second, but 100 of them took minutes. The storage wasn't the problem. cdi-controller's Kubernetes client throttles itself (controller-runtime default is 20 QPS / 30 burst), and cdi-apiserver uses the client-go defaults (5 / 10). Goroutine dumps showed the reconcile workers sitting in rate.(Limiter).Wait while the CPU was idle.

This adds -kube-api-qps and -kube-api-burst to both cdi-controller and cdi-apiserver. They default to 0, which leaves the current limits alone, so nothing changes unless you set them. You can set them with the existing customizeComponents.flags, so no API change. I wrote it up in doc/client-rate-limits.md. The limits are applied to all the clients the components create, including the early ones in cdi-controller, not just the manager's.

Numbers from cloning the same 120Gi block PVC 100 times on Pure FlashArray + Portworx, with -kube-api-qps=100 -kube-api-burst=200:

| | before | after |
|---|---|---|
| time to submit 100 DataVolumes | 56 s | 3.3 s |
| time to Succeeded per DV (paced creation) | median 27 s | median 1 s (max 3 s) |
| datavolume-pvc-clone-controller avg reconcile | ~115 ms | ~7 ms |
| clone-populator avg reconcile | ~334 ms | ~6.5 ms |

The operator bug I found along the way (flags rendered in random order) is split out into #4327.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged)*:
Refs #3470 (someone cloning 50 DataVolumes hit the same client-side throttling)

Special notes for your reviewer:

  • I used flags instead of a new CR field because customizeComponents.flags already exists for this kind of tuning and it keeps the change small. A CR field could go on top later if you want one.

  • The helper is in its own package, pkg/util/clientconfig, so the importer and cloner binaries don't pull in client-go/rest through pkg/util.

  • I ran the new unit tests and go build/go vet/gofmt. The customizeComponents.flags path is only covered by unit tests. On my cluster I set the flags with a static args patch because the deployed operator didn't have the ordering fix yet.

  • I edited the Bazel BUILD files by hand. Running gazelle over the touched directories gives no diff, so they match what it would generate.

  • There's no functional test.
  • Release note:
    ``release-note
    Add -kube-api-qps and -kube-api-burst flags to cdi-controller and cdi-apiserver (settable through customizeComponents.flags) to tune the client-side rate limit for bulk operations.
    ``

    Diff: 341 lines (+255 / -86) across 4 files Reviewer: Acedus Review duration: 52059m
    All Vouch review confidence checks passed
    Residual risk 0.43 = Change Risk (0.72) × (1 − Review Confidence (0.41)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.72 · 341 lines diff across 4 files
    0.72
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    40%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.349
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.072
    Real PR Conversation Timeline
    1 comments
    "Review active on #4325"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 40.9% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 72.5% (HIGH) · Higher = larger blast radius
    72.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 40.9% · Lower = rushed or shallow review
    40.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 42.8% · Moderate risk
    42.8%