Skip to content

[DO NOT MERGE] UPSTREAM: <carry>: fix kube_persistentvolume_plugin_type_counts#2673

Open
dfajmon wants to merge 1 commit into
openshift:masterfrom
dfajmon:OCPBUGS-44815
Open

[DO NOT MERGE] UPSTREAM: <carry>: fix kube_persistentvolume_plugin_type_counts#2673
dfajmon wants to merge 1 commit into
openshift:masterfrom
dfajmon:OCPBUGS-44815

Conversation

@dfajmon
Copy link
Copy Markdown

@dfajmon dfajmon commented May 26, 2026

What type of PR is this?

What this PR does / why we need it:

Which issue(s) this PR is related to:

Special notes for your reviewer:

Does this PR introduce a user-facing change?


Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


Summary by CodeRabbit

  • New Features

    • Enhanced persistent volume metrics collection with explicit tracking of metric-capable volume plugins.
    • Added support for metrics for local volume plugins.
  • Tests

    • New unit tests validating volume plugin name reporting for persistent volume metrics.

@openshift-ci-robot openshift-ci-robot added the backports/unvalidated-commits Indicates that not all commits come to merged upstream PRs. label May 26, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 26, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 26, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@dfajmon: the contents of this pull request could not be automatically validated.

The following commits could not be validated and must be approved by a top-level approver:

Comment /validate-backports to re-evaluate validity of the upstream PRs, for example when they are merged upstream.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 26, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dfajmon
Once this PR has been reviewed and has the lgtm label, please assign bertinatto for approval. For more information see the Code Review Process.

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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Walkthrough

Persistent volume controller adds a separate metrics plugin manager, initialized from metrics-specific volume plugins probed during setup. Local volume plugin is registered. Metrics plugins are probed and wired into controller initialization, allowing metrics collection to use different plugins than volume provisioning.

Changes

Metrics Plugin Manager Integration

Layer / File(s) Summary
Controller-manager plugin probing and local plugin link
cmd/kube-controller-manager/app/plugins.go
Import k8s.io/kubernetes/pkg/volume/local and append local.ProbeVolumePlugins() results to the controller-manager's probed plugin set.
Metrics plugin probing in controller construction
cmd/kube-controller-manager/app/core.go
newPersistentVolumeBinderController calls ProbePersistentVolumePlugins and assigns the result to ControllerParameters.MetricsVolumePlugins, returning an error if probing fails.
Metrics plugin manager and controller wiring
pkg/controller/volume/persistentvolume/pv_controller_base.go, pkg/controller/volume/persistentvolume/pv_controller.go
ControllerParameters gains MetricsVolumePlugins; PersistentVolumeController gains metricsPluginMgr. NewController initializes metricsPluginMgr from p.MetricsVolumePlugins and metrics registration uses &ctrl.metricsPluginMgr.
Plugin name resolution test
pkg/controller/volume/persistentvolume/metrics/metrics_test.go
Adds TestGetPVPluginName to verify getPVPluginName returns kubernetes.io/csi:<driver> when CSI plugins are registered and pluginNameNotAvailable when absent.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed Test file metrics_test.go has stable, deterministic test names with no dynamic values, generated identifiers, timestamps, or other unstable elements that could change between runs.
Test Structure And Quality ✅ Passed PR adds only standard Go tests, not Ginkgo tests. The custom check explicitly reviews "Ginkgo test code," making it inapplicable to this PR.
Microshift Test Compatibility ✅ Passed PR adds only a standard Go unit test (TestGetPVPluginName), not Ginkgo e2e tests. MicroShift compatibility check only applies to Ginkgo e2e tests.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No Ginkgo e2e tests are added in this PR. The only test file added is metrics_test.go with TestGetPVPluginName, which is a standard Go unit test (not a Ginkgo test). The check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies only internal Go controller code for metrics collection. No deployment manifests, scheduling constraints, or topology-related configurations were added or modified.
Ote Binary Stdout Contract ✅ Passed PR modifies kube-controller-manager (production code), not OTE binaries. OTE Binary Stdout Contract applies only to openshift-tests extension binaries, not system components.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No Ginkgo e2e tests were added in this PR. The only new test is a standard Go unit test (TestGetPVPluginName) that does not use Ginkgo patterns or test e2e functionality.
Title check ✅ Passed The title clearly references the specific fix being implemented (kube_persistentvolume_plugin_type_counts) and identifies it as an upstream carry patch, directly relating to the core changes across multiple files that add metrics plugin support.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/kube-controller-manager/app/core.go`:
- Around line 334-336: The error return in newPersistentVolumeBinderController
incorrectly returns three values; change the error path in the metrics volume
plugin probe to return only (nil, error) by removing the extraneous boolean and
wrap the original probe error using fmt.Errorf("failed to probe metrics volume
plugins when starting persistentvolume controller: %w", err) so the function
signature (Controller, error) is respected and the underlying error is
preserved.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 55e2cc95-d7d6-404c-bb43-74e4598e3128

📥 Commits

Reviewing files that changed from the base of the PR and between 99b75aa and 5c2d4b1.

📒 Files selected for processing (5)
  • cmd/kube-controller-manager/app/core.go
  • cmd/kube-controller-manager/app/plugins.go
  • pkg/controller/volume/persistentvolume/metrics/metrics_test.go
  • pkg/controller/volume/persistentvolume/pv_controller.go
  • pkg/controller/volume/persistentvolume/pv_controller_base.go

Comment thread cmd/kube-controller-manager/app/core.go
…ng plugin_name

Commit 9e29f95 refactored KCM volume plugins, replacing
ProbeControllerVolumePlugins (which included CSI) with
ProbeProvisionableRecyclableVolumePlugins (filtered to
Provisionable/Deletable/Recyclable). The CSI plugin implements none
of those interfaces, so it was excluded from volumePluginMgr.

metrics.Register was still using &ctrl.volumePluginMgr, so
getPVPluginName() -> FindPluginBySpec() failed for CSI PVs,
falling back to "N/A" instead of e.g. "kubernetes.io/csi:ebs.csi.aws.com".

Fix: initialize a separate metricsPluginMgr with all plugins
(ProbePersistentVolumePlugins, no filter) and pass it to
metrics.Register.

Fixes: OCPBUGS-44815

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@openshift-ci-robot
Copy link
Copy Markdown

@dfajmon: the contents of this pull request could not be automatically validated.

The following commits could not be validated and must be approved by a top-level approver:

Comment /validate-backports to re-evaluate validity of the upstream PRs, for example when they are merged upstream.

@dfajmon dfajmon changed the title UPSTREAM: <carry>: fix kube_persistentvolume_plugin_type_counts missi… [DO NOT MERGE] UPSTREAM: <carry>: fix kube_persistentvolume_plugin_type_counts May 27, 2026
@dfajmon dfajmon marked this pull request as ready for review May 28, 2026 12:49
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 28, 2026
@openshift-ci openshift-ci Bot requested review from bertinatto and jacobsee May 28, 2026 12:50
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 28, 2026

@dfajmon: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/unit dd4a857 link true /test unit
ci/prow/e2e-aws-ovn-runc dd4a857 link false /test e2e-aws-ovn-runc
ci/prow/e2e-aws-ovn-techpreview dd4a857 link false /test e2e-aws-ovn-techpreview
ci/prow/verify dd4a857 link true /test verify

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backports/unvalidated-commits Indicates that not all commits come to merged upstream PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants