Skip to content

Consistent units in status.recommendation when displaying memory as "raw bytes" #8397

@akrzos

Description

@akrzos

Which component are you using?:

/area vertical-pod-autoscaler

What version of the component are you using?:

vertical-pod-autoscaler.v4.19.0-202507171007

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

# kubectl version
Client Version: v1.32.1
Kustomize Version: v5.5.0
Server Version: v1.32.5

What environment is this in?:

libvirt virtual machines

What did you expect to happen?:

I expect recommendations to be provided in consistent units when --humanize-memory=false. I also expect units to be consistent either SI or IEC when --human-memory=true

What happened instead?:

Without setting --humanize-memory in the status field for a VPA CR I see:

    recommendation:
      containerRecommendations:
      - containerName: stress
        lowerBound:
          cpu: 25m
          memory: 262144k
        target:
          cpu: 25m
          memory: 262144k
        uncappedTarget:
          cpu: 25m
          memory: 262144k
        upperBound:
          cpu: 13987m
          memory: "14623264705"

For target.memory the value 262144k means 262144000 bytes, why not just show 262144000 instead of appending a unit to the value?

When I have set --humanize-memory on the recommender I observed:

    containerRecommendations:
    - containerName: stress
      lowerBound:
        cpu: 25m
        memory: 250Mi
      target:
        cpu: 25m
        memory: 250Mi
      uncappedTarget:
        cpu: 25m
        memory: 250Mi
      upperBound:
        cpu: 5291m
        memory: 5529770393600m

Now it seems most memory recommendations used a binary unit however upperBound still did not.

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

Create a VPA and observe the status.recommendation field units

Anything else we need to know?:

I would expect without --humanize-memory that the displayed memory would always be in a "unitless" display of just bytes.

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