[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: default resource requests are not being set on containers



Here's why it happens: If a container has resource limits defined (and doesn't define any requests), then the requests default to the limits. The values are copied from the limits to the requests before the values from the LimitRange are applied to the pod. Because resource requests on the container are already set when applying LimitRange values, requests from the LimitRange object are never applied.

Looks like a bug (or at least this behaviour is not what users expect).


On 12. 03. 2017 19:20, Miklos Balazs wrote:
Hello,

I have noticed a strange issue which seems to me should not work like that:

There is a LimitRange definition in a project, with the following contents:
(...)
spec:
  limits:
  - default:
      cpu: "2"
      memory: 1Gi
    defaultRequest:
      cpu: 20m
      memory: 64Mi
    max:
      cpu: "2"
      memory: 1Gi
    min:
      cpu: 20m
      memory: 64Mi
    type: Container

I know that this definition is actually being used by the controllers, because if I create a DC without defining a "resources" attribute under the container definition, the resulting pods have the resources attribute filled in properly:

(...oc export pod output:...)
    resources:
      limits:
        cpu: "2"
        memory: 1Gi
      requests:
        cpu: 20m
        memory: 64Mi
(...)

However, the problem is that when I set a "resources" attribute like this in the DC - without defining a resources.requests attribute:

(..oc export dc output:...)
        resources:
          limits:
            cpu: "1"
            memory: 512Mi
(...)

Then the resulting pod has the following under the "resources" attribute:

(...oc export pod output:....)
    resources:
      limits:
        cpu: "1"
        memory: 512Mi
      requests:
        cpu: "1"
        memory: 512Mi
(...)

Why is the request the same as the limit here? Shouldn't it be 20m / 64Mi as specified in the limit range? I am using origin-1.4.1.

Regards,
Miklos




_______________________________________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]