Bug 1271779 - Limit range should not allow min > defaultRequest
Limit range should not allow min > defaultRequest
Status: CLOSED CURRENTRELEASE
Product: OpenShift Container Platform
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
3.1.0
Unspecified Unspecified
unspecified Severity medium
: ---
: ---
Assigned To: Fabiano Franz
Wei Sun
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-14 13:29 EDT by Peter Ruan
Modified: 2015-11-23 09:26 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-23 09:26:04 EST
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 Peter Ruan 2015-10-14 13:29:19 EDT
Description of problem:
  The limitrange should not allow min to be > defaultRequest

Version-Release number of selected component (if applicable):
1.0.6

How reproducible:
always

Steps to Reproduce:
1. Login and create a project.
$ oc login -u user1
$ oc new-project proj1
$ oadm policy add-role-to-user cluster-admin  user1  -n  proj1
2. 2. Set limit for pod/container with min > defaultRequest
 $ oc create -f limit.yaml
apiVersion: v1
kind: LimitRange
metadata:
  name: limits
  namespace: proj1
spec:
  limits:
  - type: Container
    defaultRequest:
      cpu: 200m
      memory: 1Gi
    min:
      cpu: 400m
      memory: 2Gi
3.

Actual results:
limitrange created.

Expected results:
failed with error 
The LimitRange "limits" is invalid.

* spec.limits[0].defaultRequest[cpu]: invalid value '200m', Details: min value 400m is greater than default request value 200m
* spec.limits[0].defaultRequest[memory]: invalid value '1Gi', Details: min value 2Gi is greater than default request value 1Gi

Additional info:
Comment 3 Fabiano Franz 2015-10-20 13:08:24 EDT
Fixed in origin.
Comment 4 Liang Xia 2015-10-21 01:54:26 EDT
Verified this has been fixed.

Please help to move it to ON_QA, so we can move it to verified.

$ oc version
oc v3.0.2.901-61-g568adb6
kubernetes v1.1.0-alpha.1-653-g86b4e77


$ oc create -f limit.yaml 
The LimitRange "limits" is invalid.
* spec.limits[0].defaultRequest[cpu]: invalid value '200m', Details: min value 400m is greater than default request value 200m
* spec.limits[0].default[cpu]: invalid value '400m', Details: min value 400m is greater than default value 200m
* spec.limits[0].defaultRequest[memory]: invalid value '1Gi', Details: min value 2Gi is greater than default request value 1Gi
* spec.limits[0].default[memory]: invalid value '2Gi', Details: min value 2Gi is greater than default value 1Gi


$ cat limit.yaml 
apiVersion: v1
kind: LimitRange
metadata:
  name: limits
  namespace: proj1
spec:
  limits:
  - type: Container
    default:
      cpu: 200m
      memory: 1Gi
    min:
      cpu: 400m
      memory: 2Gi
Comment 5 Liang Xia 2015-10-21 22:09:03 EDT
Move to verified based on #comment 4
Comment 6 Brenton Leanhardt 2015-11-23 09:26:04 EST
This fix is available in OpenShift Enterprise 3.1.

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