<p>I have a Kubernetes cluster executing Jobs of different types (I'm not using <code>parallelism</code>, these are independent and unrelated jobs).</p>

<p>Each <code>Job</code> has a label <code>userid=xyz</code>, that's the id of the user who requested the job (users submit these requests trough my app, not to the cluster directly). </p>

<p><strong>I want to limit the number of Jobs running at any given time by tag, for example, limit the jobs with <code>userid=foo</code> to 10, and <code>userid=bar</code> to 50. Is it possible to achieve this on Kubernetes?</strong></p>

<p>You could use a <a href="https://kubernetes.io/docs/concepts/policy/resource-quotas/#object-count-quota" rel="nofollow noreferrer">ResourceQuota</a> to accomplish something similar.</p>

<p>There is no direct way to limit the job objects themselves using Resource Quota, but there may be other ways you can accomplish the same effect, by limiting the number of CPUs, or the number of pods.</p>

<p>For custom policies and logic around labels as you mentioned, admission control is a good place to enforce it. <a href="https://github.com/kubernetes/community/blob/master/contributors/design-proposals/admission_control_extension.md" rel="nofollow noreferrer">Extensible admission control</a> is going into alpha in Kubernetes 1.7.</p>
