← Back to Pull requests

Add Scale Test #284

Closed
unknown closed this pull request without merging on Aug 14, 2026 18:22 UTC
View on GitHub
unknown unknown commented on Jun 27, 2026 20:48 UTC
Author

Description

This PR adds a scale test harness for Node Readiness Controller. The test harness runs on a single rule on a 1000 nodes by default, and offers different tuning parameters for QPS, Burst, concurrent workers, among others.

Benchmarking plan:

In this first iteration, we test how NRC performs when reconciling a single NodeReadinessRule in continuous mode to 1000 nodes (default node count).
We switch conditions to true and false to observe the controller adding and removing taints from nodes.

Next iterations can include more test cases, like:

  • Different node counts

  • Different rule counts

  • Bootstrap-only mode

  • Different runtimes (kind, podman)
  • We also selected the metrics we deemed most relevant for the scalability report.

    Here's a list of all metrics exposed/scraped during the test run:

    <details><summary>available metrics at the controller endpoint</summary>
    <p>

  • Custom Controller Metrics (Node Readiness Specific)
  • • node_readiness_condition_failures_total: Total number of failed condition evaluations by rule and condition name.
    • node_readiness_evaluation_duration_seconds_bucket / _count / _sum: Histogram of the duration (in seconds) taken
    to evaluate rules.
    • node_readiness_reconciliation_latency_seconds_bucket / _count / _sum: Histogram of total node readiness
    reconciliation latency.
    • node_readiness_rule_last_reconciliation_timestamp_seconds: Timestamp (Unix epoch) when a rule was last reconciled.
    • node_readiness_rules_total: Total number of active node readiness rules.
    • node_readiness_taint_operations_total: Total number of taint operations (add/remove) executed.

  • controller-runtime Core Metrics
  • • controller_runtime_active_workers: Number of active reconciler workers.
    • controller_runtime_max_concurrent_reconciles: Configured maximum concurrent reconciles for a controller.
    • controller_runtime_reconcile_total: Total number of reconciliations.
    • controller_runtime_reconcile_errors_total: Total number of reconciliation errors.
    • controller_runtime_reconcile_panics_total: Total number of reconciler panics.
    • controller_runtime_reconcile_time_seconds_bucket / _count / _sum: Histogram of time spent on reconciliations.
    • controller_runtime_conversion_webhook_panics_total / controller_runtime_webhook_panics_total: Total panics inside
    conversion or admission webhooks.
    • controller_runtime_terminal_reconcile_errors_total: Total terminal reconciliation errors.

  • client-go Workqueue Metrics
  • • workqueue_adds_total: Total number of tasks added to the workqueue.
    • workqueue_depth: Current queue depth.
    • workqueue_longest_running_processor_seconds: Processing time of the longest running task.
    • workqueue_queue_duration_seconds_bucket / _count / _sum: Histogram of how long items sit in the workqueue before
    processing.
    • workqueue_work_duration_seconds_bucket / _count / _sum: Histogram of how long processing an item takes.
    • workqueue_retries_total: Total number of task retries.
    • workqueue_unfinished_work_seconds: Seconds spent on currently running unfinished tasks.

  • client-go REST Client Metrics
  • • rest_client_requests_total: Total HTTP requests made by the Kubernetes API client.

  • OS Process Metrics (Host Resources)
  • • process_cpu_seconds_total: Total CPU user and system time spent in seconds.
    • process_resident_memory_bytes: Resident memory size (RSS) in bytes.
    • process_virtual_memory_bytes / _max_bytes: Virtual memory size.
    • process_open_fds / _max_fds: Number of open file descriptors.
    • process_network_receive_bytes_total / _transmit_bytes_total: Network traffic bytes.
    • process_start_time_seconds: Start time of the process.

  • Go Runtime Internal Metrics
  • • go_goroutines: Number of active goroutines.
    • go_threads: Number of OS threads.
    • go_info: Information about the Go runtime version.
    • go_memstats_alloc_bytes / go_memstats_sys_bytes: Go heap memory stats.
    • go_gc_duration_seconds / _count / _sum: Garbage collector cycles durations.
    • go_sched_latencies_seconds_bucket: Go scheduler queue latency histogram.

  • Prometheus Scraper Metrics
  • • scrape_duration_seconds: Time taken to run the scraper query.
    • scrape_samples_scraped: Number of metric samples retrieved.
    • up: Health status of the scraped controller instance (1 = healthy, 0 = down).

    </p>
    </details>

    Key design choices:

  • Use kwokctl to create the cluster and kwok binary to simulate k8s core components to keep it lightweight (no docker/ kind overhead).

  • Run the NRC as a separate binary instead of deploying to the cluster, since that would not be possible with the fake cluster created by Kwok.

  • Simulate changes in conditions using Kwok's Stage CRD. See: https://kwok.sigs.k8s.io/docs/user/stages-configuration/

  • Use Kwok's native Prometheus integration to keep the setup simple. See: https://kwok.sigs.k8s.io/docs/examples/prometheus/
  • Dependencies

    The test only depends on kwokctl and kubectl being available at PATH. We ensure kwokctl is available and download the binary to hack/tools/bin right at the start of the test, if missing.

    The dependency on Prometheus and core components of the control-plane is completely managed by kwokctl.

    Testing

    I've run the scale test multiple times, with different configurations.

    Release Notes

    Since this is mostly infra, a release note may not be necessary.

    [!NOTE]

    LLM Usage: I used Gemini 3.5 Flash Medium with Antigravity CLI for planning and writing some parts with tricky logic. The code was reviewed by me and manually test multiple times.

    Supersedes #185

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: vitorfloriano Review duration: 68974m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #284"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 20.5% · Safe to merge
    20.5%