This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
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)
3.x
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Derek Carr
Qixuan Wang
:
Depends On:
Blocks:
  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:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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):
devenv-rhel_3536
oc v1.1.3-274-g209837a
kubernetes v1.2.0-alpha.7-703-gbc4550d

How reproducible:
Always

Steps to Reproduce:
1. Set limit for a project
# cat limitrange.yaml
apiVersion: v1
kind: LimitRange
metadata:
  name: limitrange
spec:
  limits:
  - max:
      cpu: 500m
      memory: 750Mi
    min:
      cpu: 10m
      memory: 5Mi
    maxLimitRequestRatio:
      cpu: 1
      memory: 2
    type: Pod
  - default:
      cpu: 1
      memory: 4Gi
    defaultRequest:
      cpu: 110m
      memory: 100Mi
    maxLimitRequestRatio:
      cpu: 10
      memory: 8
    max:
      cpu: 1
      memory: 4Gi
    min:
      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
metadata:
  name: pod-no-limit-request
  labels:
    name: pod-no-limit-request
spec:
  containers:
  - name: pod-no-limit-request
    image: openshift3/mysql-55-rhel7:latest
    env:
    - name: MYSQL_USER
      value: userSUM
      name: MYSQL_PASSWORD
      value: P5J6s8wf
      name: MYSQL_DATABASE
      value: root
      name: MYSQL_ROOT_PASSWORD
      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.