Bug 1944587

Summary: VPA could not take actions based on the recommendation when min-replicas=1
Product: OpenShift Container Platform Reporter: Weinan Liu <weinliu>
Component: NodeAssignee: Joel Smith <joelsmith>
Node sub component: Autoscaler (HPA, VPA) QA Contact: Weinan Liu <weinliu>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: unspecified CC: aos-bugs
Version: 4.8   
Target Milestone: ---   
Target Release: 4.8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-07-27 22:56:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Weinan Liu 2021-03-30 09:54:21 UTC
Description of problem:


Version-Release number of selected component (if applicable):
$ oc get clusterversion
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.8.0-0.nightly-2021-03-26-054333   True        False         22h     Cluster version is 4.8.0-0.nightly-2021-03-26-054333


How reproducible:


Steps to Reproduce:
1. Install VPA on a ocp 4.8 cluster
2. Create a dc with replica=1

oc create -f- <<EOF
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
  name: hamster
spec:
  replicas: 1
  labels:
    app: hamster
  template:
    metadata:
      labels:
        app: hamster
    spec:
      containers:
        - name: hamster
          image: k8s.gcr.io/ubuntu-slim:0.1
          resources:
            requests:
              cpu: 100m
              memory: 50Mi
          command: ["/bin/sh"]
          args:
            - "-c"
            - "while true; do timeout 0.5s yes >/dev/null; sleep 0.5s; done"
EOF
3. Create VPA and wath the scaling

oc create -f- <<EOF	
apiVersion: "autoscaling.k8s.io/v1beta2"
kind: VerticalPodAutoscaler
metadata:
  name: hamster-vpa
spec:
  targetRef:
    apiVersion: "apps.openshift.io/v1"
    kind: DeploymentConfig
    name: hamster
  updatePolicy:
    updateMode: "Auto"
  resourcePolicy:
    containerPolicies:
      - containerName: '*'
        minAllowed:
          cpu: 100m
          memory: 50Mi
        maxAllowed:
          cpu: 1
          memory: 500Mi
        controlledResources: ["cpu", "memory"]
EOF

Actual results:
VPA could not take actions based on the recommendation when min-replicas=1 

Expected results:
VPA could not take actions based on the recommendation 
Additional info:

$ oc get dc -n hamster
NAME      REVISION   DESIRED   CURRENT   TRIGGERED BY
hamster   1          1         1         config


$ paste <(oc get pods -n hamster -o="custom-columns=Name:.metadata.name,Phase:.status.phase,CPU Req:.spec.containers[0].resources.requests.cpu") <(oc get podmetrics -n hamster -o="custom-columns=CPU Used:containers[0].usage.cpu")
Name               Phase       CPU Req	CPU Used
hamster-1-deploy   Succeeded   <none>	299m
hamster-1-hjdgk    Running     100m	

$ oc get vpa -n hamster hamster-vpa --no-headers -o "custom-columns=:\
> status.recommendation.containerRecommendations[0].target.cpu"

671m

$ oc describe vpa -n hamster

...  Recommendation:
    Container Recommendations:
      Container Name:  hamster
      Lower Bound:
        Cpu:     509m
        Memory:  262144k
      Target:
        Cpu:     671m
        Memory:  262144k
      Uncapped Target:
        Cpu:     671m
        Memory:  262144k
      Upper Bound:
        Cpu:     1
        Memory:  262144k
Events:          <none>


$ oc describe deployment.apps/vpa-admission-plugin-default
...
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
  Progressing    True    NewReplicaSetAvailable
OldReplicaSets:  vpa-admission-plugin-default-75ccbdc6fd (1/1 replicas created)
NewReplicaSet:   <none>
Events:          <none>

Comment 5 errata-xmlrpc 2021-07-27 22:56:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.8.2 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:2438