Bug 1311918 - [online_private_546] It's better to show clearer input/calculation if Pod/Container resources exceed to LimitRange
[online_private_546] It's better to show clearer input/calculation if Pod/Con...
Status: NEW
Product: OpenShift Origin
Classification: Red Hat
Component: Pod (Show other bugs)
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Derek Carr
Qixuan Wang
Depends On:
  Show dependency treegraph
Reported: 2016-02-25 05:37 EST by Qixuan Wang
Modified: 2016-05-17 21:09 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Qixuan Wang 2016-02-25 05:37:05 EST
Description of problem:
Set limitrange and then create a pod without resources specified, it's better to show clearer input/calculation (e.g. provided ratio) and uniform measurements (binary vs decimal math) if Pod/Container resources exceed to LimitRange.

Version-Release number of selected component (if applicable):
oc v1.1.3-274-g209837a
kubernetes v1.2.0-alpha.7-703-gbc4550d

How reproducible:

Steps to Reproduce:
1. Set limit for a project
# cat limitrange.yaml
apiVersion: v1
kind: LimitRange
  name: limitrange
  - max:
      cpu: 500m
      memory: 750Mi
      cpu: 10m
      memory: 5Mi
      cpu: 1
      memory: 2
    type: Pod
  - default:
      cpu: 1
      memory: 4Gi
      cpu: 110m
      memory: 100Mi
      cpu: 10
      memory: 8
      cpu: 1
      memory: 4Gi
      cpu: 10m
      memory: 5Mi
    type: Container

# oc create -f limitrange.yaml -n qwang1 --config=./admin.kubeconfig

2. Check limit resource 
# oc describe limits limitrange -n qwang1

3. Create a pod without resource specified
# cat pod-no-limit-request.yaml
apiVersion: v1
kind: Pod
  name: pod-no-limit-request
    name: pod-no-limit-request
  - name: pod-no-limit-request
    image: openshift3/mysql-55-rhel7:latest
    - name: MYSQL_USER
      value: userSUM
      name: MYSQL_PASSWORD
      value: P5J6s8wf
      name: MYSQL_DATABASE
      value: root
      value: W5J6s8wf
    resources: {}

# oc create -f pod-no-limit-request.yaml -n qwang

Actual results:
2. # oc describe limits limitrange -n qwang1
# oc describe limits limitrange -n qwang1
Name:		limitrange
Namespace:	qwang1
Type		Resource	Min	Max	Default Request	Default Limit	Max Limit/Request Ratio
----		--------	---	---	---------------	-------------	-----------------------
Pod		cpu		10m	500m	-		-		1
Pod		memory		5Mi	750Mi	-		-		2
Container	cpu		10m	1	110m		1		10
Container	memory		5Mi	4Gi	100Mi		4Gi		8

3. It seems that dropped Pod resources are calculate by Container. For example, limit is 4294967296=4*1024*1024*1024 (Default Limit of Container), provided ratio is 40.960000=4*1024/100, (default limit/default request of Container). Could the units of measurement used in them be uniform?

# oc create -f pod-no-limit-request.yaml -n qwang1
Error from server: error when creating "pod-no-limit-request.yaml": pods "pod-no-limit-request" is forbidden: [Maximum cpu usage per Pod is 500m, but limit is 1., Maximum memory usage per Pod is 750Mi, but limit is 4294967296., cpu max limit to request ratio per Pod is 1, but provided ratio is 9.090909., memory max limit to request ratio per Pod is 2, but provided ratio is 40.960000., memory max limit to request ratio per Container is 8, but provided ratio is 40.960000.]

Expected results:
It's helpful if show more explicit messages.

Additional info:
Comment 1 Luke Meyer 2016-03-03 10:22:05 EST
Upstream k8s issue: https://github.com/kubernetes/kubernetes/issues/21996

Note You need to log in before you can comment on or make changes to this bug.