Skip to content

VPA updater: export admission controller status metric - #10182

Open
dippynark wants to merge 2 commits into
kubernetes:masterfrom
dippynark:vpa-updater-export-admission-controller-status-metric
Open

VPA updater: export admission controller status metric#10182
dippynark wants to merge 2 commits into
kubernetes:masterfrom
dippynark:vpa-updater-export-admission-controller-status-metric

Conversation

@dippynark

@dippynark dippynark commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

If VPA updater is stuck taking action due to the admission controller status check, there is currently no way of detecting and alerting on this.

This PR fixes this by adding a corresponding metric so that we can alert on the following after 10 minutes:

increase(vpa_updater_admission_controller_status_invalid_total[5m]) > 0

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

None

Does this PR introduce a user-facing change?

VPA updater metric added to expose admission controller status: vpa_updater_admission_controller_status_invalid_total

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


Summary by CodeRabbit

  • Monitoring
    • Added Prometheus metrics for updater iterations skipped due to invalid Admission Controller status.
    • Metrics distinguish between status-check errors and invalid status results.

Signed-off-by: Luke Addison <lukeaddison785@gmail.com>
@kubernetes-prow kubernetes-prow Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 24, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

This issue is currently awaiting triage.

If SIG Autoscaling contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 24, 2026
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b51d7011-5c17-4583-96f4-f157e33b395a

📥 Commits

Reviewing files that changed from the base of the PR and between a1400fd and 6402840.

📒 Files selected for processing (2)
  • vertical-pod-autoscaler/pkg/updater/logic/updater_test.go
  • vertical-pod-autoscaler/pkg/utils/metrics/updater/updater_test.go

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The updater now records invalid Admission Controller status events with separate reasons for validation errors and invalid status results. Tests cover metric recording and status-check error handling.

Changes

Admission Controller status metrics

Layer / File(s) Summary
Record invalid Admission Controller status
vertical-pod-autoscaler/pkg/utils/metrics/updater/updater.go, vertical-pod-autoscaler/pkg/updater/logic/updater.go, vertical-pod-autoscaler/pkg/utils/metrics/updater/updater_test.go, vertical-pod-autoscaler/pkg/updater/logic/updater_test.go
The updater registers a reason-labeled counter and records error or invalid when Admission Controller status checks fail. Tests cover both metric labels and status-check errors.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 64028

This PR adds a localized metric for monitoring VPA updater admission-controller status; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: adrianmoisey, maxcao13, omerap12

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: exposing the VPA updater admission controller status metric.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@kubernetes-prow kubernetes-prow Bot added do-not-merge/needs-area Indicates that a PR should not merge because it lacks an area label. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 24, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @dippynark. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@kubernetes-prow kubernetes-prow Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 24, 2026
@kubernetes-prow
kubernetes-prow Bot requested review from maxcao13 and omerap12 August 24, 2026 11:47
@kubernetes-prow kubernetes-prow Bot added the area/vertical-pod-autoscaler Issues or PRs related to the Vertical Pod Autoscaler component label Aug 24, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dippynark
Once this PR has been reviewed and has the lgtm label, please assign adrianmoisey 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

@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/needs-area Indicates that a PR should not merge because it lacks an area label. label Aug 24, 2026
@dippynark
dippynark marked this pull request as ready for review August 24, 2026 11:48
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 24, 2026
@kubernetes-prow
kubernetes-prow Bot requested a review from adrianmoisey August 24, 2026 11:48
@adrianmoisey

Copy link
Copy Markdown
Member

Is it possible to add a test for this?

Signed-off-by: Luke Addison <lukeaddison785@gmail.com>
@kubernetes-prow kubernetes-prow Bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 24, 2026
@dippynark

Copy link
Copy Markdown
Contributor Author

@adrianmoisey have added a couple covering the changed paths

@maxcao13

Copy link
Copy Markdown
Member

/ok-to-test

@kubernetes-prow kubernetes-prow Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 25, 2026
@maxcao13

Copy link
Copy Markdown
Member

Seems reasonable to me.

/lgtm

$ kubectl -n kube-system delete lease vpa-admission-controller
lease.coordination.k8s.io "vpa-admission-controller" deleted from kube-system namespace
$ kubectl -n kube-system port-forward deploy/vpa-updater 8943:8943

...
...
$ curl -s localhost:8943/metrics | grep admission_controller_status
# HELP vpa_updater_admission_controller_status_invalid_total Number of times Updater skipped its main loop because the Admission Controller status Lease was missing, stale or otherwise invalid.
# TYPE vpa_updater_admission_controller_status_invalid_total counter
vpa_updater_admission_controller_status_invalid_total{reason="error"} 1

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 26, 2026
@adrianmoisey

Copy link
Copy Markdown
Member

/lgtm

Thanks!

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

Labels

area/vertical-pod-autoscaler Issues or PRs related to the Vertical Pod Autoscaler component cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants