Bug 1318983 - Container resources override doesn't happen due to incorrect master configuration
Summary: Container resources override doesn't happen due to incorrect master configura...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Pod
Version: 3.x
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ---
: ---
Assignee: Stefanie Forrester
QA Contact: Qixuan Wang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-18 10:19 UTC by Qixuan Wang
Modified: 2016-03-22 15:24 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-03-22 15:24:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Qixuan Wang 2016-03-18 10:19:44 UTC
Description of problem:
ClusterResourceOverride have been configured on master with Ops's help. I enabled override in project and create a pod with memory limit specified. But Container resources were not override by limits.memory. This configuration can't work on Origin either.

Version-Release number of selected component (if applicable):
dev-preview-int

How reproducible:
Always

Steps to Reproduce:
1. Check master configuration
# cat master-config.yaml

<------------snip------------------->

kubernetesMasterConfig:

admissionConfig:
  pluginOrderOverride:
  - OriginNamespaceLifecycle
  - BuildByStrategy
  - ProjectRequestLimit
  pluginConfig:
    ProjectRequestLimit:
      configuration:
        apiVersion: v1
        kind: ProjectRequestLimitConfig
        limits:
        - selector:
            admin: "true"
        - maxProjects: 1
kubernetesMasterConfig:
  admissionConfig:
    pluginOrderOverride:
    - RunOnceDuration
    - NamespaceLifecycle
    - OriginPodNodeEnvironment
    - LimitRanger
    - ServiceAccount
    - SecurityContextConstraint
    - ResourceQuota
    - SCCExecRestrictions
    pluginConfig:
      RunOnceDuration:
        configuration:
          apiVersion: v1
          kind: RunOnceDurationConfig
          activeDeadlineSecondsOverride: 3600
      ClusterResourceOverride:
        configuration:
          apiVersion: v1
          kind: ClusterResourceOverrideConfig
          limitCPUToMemoryPercent: 200
          cpuRequestToLimitPercent: 6
          memoryRequestToLimitPercent: 60


<------------snip------------------->


2. Check project override enabled
[root@qwang online]# oc describe project qwangquota | grep openshift.io
Annotations:	openshift.io/description=
		openshift.io/display-name=
		openshift.io/requester=system:admin
		openshift.io/sa.scc.mcs=s0:c47,c39
		openshift.io/sa.scc.supplemental-groups=1002240000/10000
		openshift.io/sa.scc.uid-range=1002240000/10000
		quota.openshift.io/cluster-resource-override-enabled=true



3. Create a pod with request and limit
# vi pod-limit-memory.yaml

apiVersion: v1
kind: Pod
metadata:
  name: pod-limit-memory
  labels:
    name: pod-limit-memory
spec:
  containers:
  - name: pod-limit-memory
    image: openshift/mysql-55-centos7:latest
    env:
    - name: MYSQL_USER
      value: userSUM
      name: MYSQL_PASSWORD
      value: P5J6s8wf
      name: MYSQL_DATABASE
      value: root
      name: MYSQL_ROOT_PASSWORD
      value: W5J6s8wf
    resources:
      limits:
        memory: "200Mi"

4. Check cpu/memory limit/request
# oc describe pod pod-limit-memory


Actual results:
4. 
    Limits:
      memory:	200Mi
    Requests:
      memory:		200Mi


Expected results:
Other resources should be overrode by memory limit and calculated by master configuration. So Limits.memory=200Mi, Limits.cpu=390m, Requests.memory=120Mi, Requests.cpu=24m


Additional info:

Comment 1 Luke Meyer 2016-03-18 17:46:09 UTC
(In reply to Qixuan Wang from comment #0)

> ClusterResourceOverride have been configured on master with Ops's help. I
> enabled override in project and create a pod with memory limit specified.

FWIW you don't have to enable it per-project, you only have to avoid disabling it.

> kubernetesMasterConfig:
>   admissionConfig:
>     pluginOrderOverride:
>     - RunOnceDuration
>     - NamespaceLifecycle
>     - OriginPodNodeEnvironment

ClusterResourceOverride should go in this list right here.

>     - LimitRanger
>     - ServiceAccount
>     - SecurityContextConstraint
>     - ResourceQuota
>     - SCCExecRestrictions

This is related to https://github.com/openshift/online/issues/62#issuecomment-198146929 - I've added a comment there.

Comment 2 Stefanie Forrester 2016-03-21 16:45:16 UTC
Manually added the change for now, and updated ops docs to get this into the next build (later this week).

Comment 3 Qixuan Wang 2016-03-22 03:33:14 UTC
Verified on dev-preview-int, the configuration bug has been fixed. Thanks.

    Limits:
      memory:	200Mi
      cpu:	390m
    Requests:
      cpu:		24m
      memory:		120Mi

Comment 4 Luke Meyer 2016-03-22 15:24:10 UTC
Feel free to reopen if it returns.


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