Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1336692

Summary: should not apply a value greater than 100 for CPU utilization targetPercentage by oc edit hpa $name
Product: OpenShift Container Platform Reporter: Weihua Meng <wmeng>
Component: NodeAssignee: Solly Ross <sross>
Status: CLOSED ERRATA QA Contact: DeShuai Ma <dma>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.2.0CC: agoldste, aos-bugs, jokerman, mmccomas, tdawson
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
The Horizontal Pod Autoscaler scales based on CPU usages as a percentage of the requested CPU for a pod. It is possible that the desired percentage be over 100 (if the user wants to scale only when the CPU usage of a pod is higher than the amount requested for the pod, but below the limit for the pod). Previously, the CLI would prevent the user from setting such values. Now, it allows setting a target CPU percentage of over 100.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-27 09:32:42 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 Weihua Meng 2016-05-17 08:40:15 UTC
Description of problem:
should not apply a value greater than 100 for CPU utilization targetPercentage by oc edit hpa $name

Version-Release number of selected component (if applicable):
oc v3.2.0.44
kubernetes v1.2.0-36-g4a3f9c5

How reproducible:
Always

Steps to Reproduce:
1. create hpa
2. oc edit hpa $name
spec:
  cpuUtilization:
    targetPercentage: 23456
save and quit
horizontalpodautoscaler "$name" edited
3. oc get hpa $name
NAME                REFERENCE                                       TARGET    CURRENT     MINPODS   MAXPODS   AGE
hello-openshift02   ReplicationController/hello-openshift02/scale   23456%    <waiting>   4         9         44m

Actual results:
TARGET 23456% greater than 100%

Expected results:
should not accept when save and quit

Additional info:
# oc autoscale rc php-apache --max=5 --cpu-percent=150
CPU utilization (%) cannot exceed 100

Comment 1 Solly Ross 2016-05-18 15:31:02 UTC
It's technically valid to specify a target CPU over 100%, since the target is a percentage of requests, and not limits, so it's quite possible for CPU to go over 100% of the requests (see a discussion here for more information: https://github.com/kubernetes/kubernetes/pull/18294).  While you generally don't want a value over 100%, there are valid cases where you might.

It is confusing, however, that `kubectl autoscale` prevents you from setting a value higher than 100, instead of just warning about it.

Comment 2 Solly Ross 2016-05-18 15:41:24 UTC
I've opened an upstream issue to discuss: https://github.com/kubernetes/kubernetes/issues/25815

Comment 3 Andy Goldstein 2016-06-22 10:54:26 UTC
https://github.com/kubernetes/kubernetes/pull/26162 fixes this and it has merged upstream. It's not in origin or ose yet.

Comment 4 Andy Goldstein 2016-07-22 18:34:50 UTC
This is in origin and should be in the 3.3 builds

Comment 5 Weihua Meng 2016-07-25 03:15:32 UTC
Fixed.
openshift v3.3.0.9
kubernetes v1.3.0+57fb9ac
etcd 2.3.0+git

Agree that  targetPercentage can exceed 100%.
Since CLI and oc edit are consistent, It is OK.

Comment 7 errata-xmlrpc 2016-09-27 09:32:42 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, 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/RHBA-2016:1933