anchor.diff:    scopes:
     - BestEffort <2>
   ----
  -<1> The total number of pods in a non-terminal state with `BestEffort` quality of service that can exist in the project
  -<2> Restricts the quota to only matching pods that have `BestEffort` quality of service for either memory or cpu.
  -====
  -
  -== Create a Quota
  -
  -To apply a quota to a project:
  -
  -----
  -$ oc create -f resource-quota.json
  -----
  -
  -== View a Quota
  -
  -To view usage statistics related to any hard limits defined in your quota:
  -
  -----
  -$ oc get quota
  -NAME
  -quota
  -$ oc describe quota quota
  -Name:                         quota
  -Resource                      Used    Hard
  ---------                      ----    ----
  -cpu                           5       20
  -memory                        500Mi   1Gi
  -pods                          5       10
  -replicationcontrollers        5       5
  -resourcequotas                1       1
  -services                      3       5
  -----
  -
  -[[configuring_quota_sync_period]]
  -
  -== Configuring the Quota Synchronization Period
  -
  -When a set of resources are deleted, the synchronization timeframe of resources
  +<1> The total number of pods in a non-terminal state with *BestEffort* quality
  +of service that can exist in the project.
  +<2> Restricts the quota to only matching pods that have *BestEffort* quality of
  +service for either memory or CPU.
  +====
  +
  +[[create-a-quota]]
  +== Creating a Quota
  +
  +To create a quota, first define the quota to your specifications in a file, for
  +example as seen in
  +link:../admin_guide/quota.html#sample-resource-quota-definitions[Sample Resource
  +Quota Definitions]. Then, create using that file to apply it to a project:
  +
  +----
  +$ oc create -f <resource_quota_definition> [-n <project_name>]
  +----
  +
  +For example:
  +
  +----
  +$ oc create -f resource-quota.json -n demoproject
  +----
  +
  +[[viewing-a-quota]]
  +== Viewing a Quota
  +
  +To view usage statistics related to any hard limits defined in a quota, first
  +get the list of quotas defined in the project. For example, for a project called
  +*demoproject*:
  +
  +====
  +----
  +$ oc get quota -n demoproject
  +NAME                AGE
  +besteffort          11m
  +compute-resources   2m
  +object-counts       29m
  +----
  +====
  +
  +Then, describe the resource quota you are interested in, for example a
  +*object-counts* quota:
  +
  +====
  +----
  +$ oc describe quota object-counts -n demoproject
  +Name:			object-counts
  +Namespace:		demoproject
  +Resource		Used	Hard
  +--------		----	----
  +configmaps		3	10
  +persistentvolumeclaims	0	4
  +replicationcontrollers	3	20
  +secrets			9	10
  +services		2	10
  +----
  +====
  +
  +[[configuring-quota-sync-period]]
  +== Configuring Quota Synchronization Period
  +
  +When a set of resources are deleted, the synchronization time frame of resources
   is determined by the `*resource-quota-sync-period*` setting in the
  -*_/etc/origin/master/master-config.yaml_* file. Before your quota usage is
  -restored, you may encounter problems when attempting to reuse the resources.
  -Change the `*resource-quota-sync-period*` setting to have the set of resources
  -regenerate at the desired amount of time (in seconds) and for the resources to
  -be available again:
  +*_/etc/origin/master/master-config.yaml_* file.
  +
  +Before quota usage is restored, a user may encounter problems when attempting to
  +reuse the resources. You can change the `*resource-quota-sync-period*` setting
  +to have the set of resources regenerate at the desired amount of time (in
  +seconds) and for the resources to be available again:
   
   ====
   ----
  
positive.code: :experimental:
  :toc: macro
  :toc-title:
  
  toc::[]
  
  == Overview
  
  A `ResourceQuota` defines constraints that limit aggregrate resource consumption
  per project.  It can limit the quantity of objects that can be created in a project
  by type, as well as the total amount of link:compute_resources.html[compute resources]
  that may be consumed by resources in that project.
  
  == Resources managed by quota
  
  The following describes the set of resources that may be managed by a `ResourceQuota`.
  
  .Resources managed by quota
  [cols="3a,8a",options="header"]
  |===
  
  |Resource Name |Description
  
  |`configmaps`
  |Total number of configmaps
  
  |`cpu`
  |Across all pods in a non-terminal state, the sum of cpu requests cannot exceed this value.
  
  |`memory`
  |Across all pods in a non-terminal state, the sum of memory requests cannot exceed this value.
  
  |`requests.cpu`
  |Across all pods in a non-terminal state, the sum of cpu requests cannot exceed this value.
  
  |`requests.memory`
  |Across all pods in a non-terminal state, the sum of memory requests cannot exceed this value.
  
  |`limits.cpu`
  |Across all pods in a non-terminal state, the sum of cpu limits cannot exceed this value.
  
  |`limits.memory`
  |Across all pods in a non-terminal state, the sum of memory limits cannot exceed this value.
  
  |`configmaps`
  |The total number of config maps that can exist in the project.
  
  |`pods`
  |The total number of pods in a non-terminal state that can exist in the project.  A pod is in a terminal state if `status.phase in (Failed, Succeeded)` is true.
  
  |`replicationcontrollers`
  |The total number of replication controllers that can exist in the project.
  
  |`resourcequotas`
  |The total number of resource quotas that can exist in the project.
  
  |`services`
  |The total number of services that can exist in the project.
  
  |`secrets`
  |The total number of secrets that can exist in the project.
  
  |`persistentvolumeclaims`
  |The total number of persistent volume claims that can exist in the project.
  |===
  
  == Quota Scopes
  
  Each quota can have an associated set of scopes.  A quota will only
  measure usage for a resource if it matches the intersection of enumerated
  scopes.
  
  Adding a scope to a quota limits the number of resources it supports
  to those that pertain to the scope.  Specifying a resource on the quota outside
  of the allowed set would result in a validation error.
  
  .Quota scopes
  [cols="3a,8a",options="header"]
  |===
  
  |Scope |Description
  
  |`Terminating`
  |Match pods where `spec.activeDeadlineSeconds >= 0`
  
  |`NotTerminating`
  |Match pods where `spec.activeDeadlineSeconds is nil`
  
  |`BestEffort`
  |Match pods that have best effort quality of service for either `cpu` or `memory`.
  
  |`NotBestEffort`
  |Match pods that do not have best effort quality of service for `cpu` and `memory`.
  |===
  
  A `BestEffort` scope restricts a quota to limit the following resources:
  
  1. pods 
  
  A `Terminating`, `NotTerminating`, and `NotBestEffort` scope restricts a quota to tracking the following resources:
  
  1. `pods`
  2. `memory`, `requests.memory`, `limits.memory`
  3. `cpu`, `requests.cpu`, `limits.cpu`
  
  == Quota Enforcement
  
  After a project quota is first created, the project restricts the ability
  to create any new resources that may violate a quota constraint until it has
  calculated updated usage statistics.
  
  Once a quota is created and usage statistics are up-to-date, the project accepts
  the creation of new content. When you create or modify resources, your quota
  usage is incremented immediately upon the request to create or modify the
  resource. When you delete a resource, your quota use is decremented during the
  next full recalculation of quota statistics for the project. When you delete
  resources, a link:#configuring_quota_sync_period[configurable amount of time]
  determines how long it takes to reduce quota usage statistics to their current
  observed system value.
  
  If project modifications exceed a quota usage limit, the server denies the
  action, and an appropriate error message is returned to the end-user explaining
  the quota constraint violated, and what their currently observed usage stats are
  in the system.
  
  === Compute Resources: Requests vs Limits
  
  When allocating compute resources, each container may specify a request and a limit value
  for either CPU or memory.  The quota can be configured to quota either value.  If the quota
  has a value specified for `requests.cpu` or `requests.memory`, then it will require that 
  every incoming container makes an explicit request for those resources.  If the quota has a 
  value specified for `limits.cpu` or `limits.memory`, then it will require that every incoming
  container specifies an explicit limit for those resources.
  
  == Sample Resource Quota Files
  
  object-counts.yaml
  ====
  ----
  apiVersion: v1
  
negative.code: ----
  ====
  
  After making any changes, restart the master service to apply them.
  
  Adjusting the regeneration time can be helpful for creating resources and
  determining resource usage when automation is used.
  
  [NOTE]
  ====
  The `*resource-quota-sync-period*` setting is designed to balance system
  performance. Reducing the sync period can result in a heavy load on the master.
  ====
  
  ifdef::openshift-origin,openshift-enterprise,openshift-dedicated[]
  [[accounting-quota-dc]]
  == Accounting for Quota in Deployment Configurations
  
  If a quota has been defined for your project, see
  link:../dev_guide/deployments.html#deployment-resources[Deployment Resources]
  for considerations on any deployment configurations.
  endif::[]
  