← Back to Pull requests

cdi: expose secure pprof endpoints for controller and operator #4161

Merged
Acedus merged 7 files (88 lines) on Jun 03, 2026 19:47 UTC
View on GitHub
Acedus Acedus commented on May 27, 2026 14:44 UTC
Author

<!-- Thanks for sending a pull request! Here are some tips for you:
1. Follow the instructions for writing a release note from k8s: https://git.k8s.io/community/contributors/guide/release-notes.md
-->

What this PR does / why we need it:
pprof is Go's built-in profiling toolkit that exposes runtime diagnostics (e.g., heap allocations, goroutine stacks, CPU profiles, etc.) over HTTP. Exposing these endpoints enables live debugging of memory leaks, goroutine leaks, and CPU hotspots in running controller and operator pods without redeployment or recompilation.

This PR exposes the handlers via the existing metrics server by relying on controller-runtime's ExtraHandlers along with the previously introduced WithAuthenticationAndAuthorization which serves to secure the handlers with TLS and RBAC auth. A new ClusterRole (cdi-pprof-reader) is added to grant pprof access independently of metrics scraping.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:
Registering the handlers adds no runtime overhead, the Go runtime already tracks the underlying profiling data, and CPU/trace profiles only activate on-demand when explicitly requested.

This PR depends on https://github.com/kubevirt/containerized-data-importer/pull/4121, review only the last commit.

Release note:
<!-- Write your release note:
1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required".
2. If no release note is required, just write "NONE".
-->
``release-note
Expose secure pprof endpoints on controller and operator for live runtime diagnostics
``

Diff: 88 lines (+87 / -1) across 7 files Reviewer: dsanatar Review duration: 10382m
All Vouch review confidence checks passed
Residual risk 0.03 = Change Risk (0.39) × (1 − Review Confidence (0.91)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 88 lines diff across 7 files
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.90 · 4 substantive comment(s)
0.90
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
91%
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.269
Real PR Conversation Timeline
7 items
Acedus Acedus commented on May 27, 2026 14:45 UTC
Author

/cc @akalenyu

coveralls coveralls commented on May 30, 2026 10:26 UTC
Contributor

![Coverage Status](https://coveralls.io/builds/79689709)

coverage: 49.435% (-0.1%) from 49.56% — Acedus:add-pprof-endpoints into kubevirt:main

akalenyu akalenyu commented on Jun 03, 2026 12:53 UTC
Contributor

/test pull-containerized-data-importer-non-csi-hpp

akalenyu akalenyu commented on Jun 03, 2026 12:54 UTC
Reviewer

/approve

kubevirt-bot kubevirt-bot commented on Jun 03, 2026 12:54 UTC
Bot

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: <a href="https://github.com/kubevirt/containerized-data-importer/pull/4161#pullrequestreview-4418675020" title="Approved">akalenyu</a>

The full list of commands accepted by this bot can be found here.

The pull request process is described here

<details >
Needs approval from an approver in each of these files:

  • ~~OWNERS~~ [akalenyu]
  • Approvers can indicate their approval by writing /approve in a comment
    Approvers can cancel approval by writing /approve cancel in a comment
    </details>
    <!-- META={"approvers":[]} -->

    dsanatar dsanatar approved these changes on Jun 03, 2026 19:42 UTC
    Approved Reviewer

    cool!

    Reviewers
    Assignees
    Acedus Acedus
    Labels
    risk: low confidence: 91% 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: 38.6% (MEDIUM) · Higher = larger blast radius
    38.6%
    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: 91% · Lower = rushed or shallow review
    91%
    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: 3.5% · Safe to merge
    3.5%