Skip to content

vpa-updater: Initialize counters with 0 #9058

@ialidzhikov

Description

@ialidzhikov

Which component are you using?:
/area vertical-pod-autoscaler

What version of the component are you using?:

Component version: v1.5.0

What k8s version are you using (kubectl version)?:

kubectl version Output
$ kubectl version

What environment is this in?:

Local setup

What did you expect to happen?:

vpa-updater emits per-VPA metrics such as vpa_updater_in_place_updated_pods_total. In particular, vpa_updater_in_place_updated_pods_total is counter.

ChatGPT when asked whether components should always report counts from start, even if 0:

TL;DR Best Practice
✅ Components should always expose counters from start, even if 0.
✅ This ensures dashboards, alerts, and increase()/rate() behave correctly.
❌ Avoid only reporting when the counter increments.

What happened instead?:

vpa-updater does not expose vpa_updater_in_place_updated_pods_total from start with value 0 for VPAs.
This breaks increase()/rate() usages on this counter.

How to reproduce it (as minimally and precisely as possible):

  1. Create a new VPA.

  2. Ensure that vpa-updater does not emit metrics for vpa_updater_in_place_updated_pods_total for the new VPA until there is an in-place eviction for that VPA:

    % curl http://localhost:8943/metrics | grep resource-consumer
    (no output)
    
  3. Adapt the VPA so that it performs an in-place update (for example increase the minAllowed values)

  4. Ensure that vpa-updater starts emitting vpa_updater_in_place_updated_pods_total for that VPA only when there is an in-place eviction about it.

    % curl http://localhost:8943/metrics | grep resource-consumer
    vpa_updater_in_place_updated_pods_total{vpa_name="resource-consumer",vpa_namespace="default",vpa_size_log2="0"} 1
    

Anything else we need to know?:
N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions