Skip to content

[FG:InPlacePodVerticalScaling] Minimum CPU request is displayed when only memory request is configured #126195

@hshiina

Description

@hshiina

What happened?

If InPlacePodVerticalScaling is enabled and only a memory resource request is configured in a pod, the minimum CPU request set internally is displayed in the pod status:

$ kubectl get pod testpod -o jsonpath='spec: {.spec.containers[0].resources}{"\nallocatedResources: "}{.status.containerStatuses[0].allocatedResources}{"\nstatus: "}{.status.containerStatuses[0].resources}{"\n"}'
spec: {"requests":{"memory":"200Mi"}}
allocatedResources: {"memory":"200Mi"}
status: {"requests":{"cpu":"2m","memory":"200Mi"}}

What did you expect to happen?

The minimum CPU request is not displayed in the pod status.

How can we reproduce it (as minimally and precisely as possible)?

  1. Enables the InPlacePodVerticalScaling feature.

  2. Create a pod where only memory request is configured:

    apiVersion: v1
    kind: Pod
    metadata:
      labels:
        run: testpod
      name: testpod
    spec:
      containers:
      - image: nginx
        name: testpod
        resources:
          requests:
            memory: 200Mi
      restartPolicy: Always
    
  3. See its resources in the pod status:

    $ kubectl get pod testpod -o jsonpath='spec: {.spec.containers[0].resources}{"\nallocatedResources: "}{.status.containerStatuses[0].allocatedResources}{"\nstatus: "}{.status.containerStatuses[0].resources}{"\n"}'
    spec: {"requests":{"memory":"200Mi"}}
    allocatedResources: {"memory":"200Mi"}
    status: {"requests":{"cpu":"2m","memory":"200Mi"}}
    

Anything else we need to know?

No response

Kubernetes version

$ kubectl version
Client Version: v1.30.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.30.0

Cloud provider

N/A

OS version

# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here

Install tools

Container runtime (CRI) and version (if applicable)

Related plugins (CNI, CSI, ...) and versions (if applicable)

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.sig/nodeCategorizes an issue or PR as relevant to SIG Node.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

Status

Done

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions