<p>If I have a custom resource definition like this:</p>

<pre><code>$ kubectl get crd unifiedpushservers.push.aerogear.org
NAME                                   CREATED AT
unifiedpushservers.push.aerogear.org   2019-06-05T13:39:23Z
</code></pre>

<p>Is it possible to create a <code>ResourceQuota</code> that would limit the count of this type of custom resource to 1, refusing attempts to create additional ones?</p>

<p>Here's what I've tried so far:</p>

<pre><code>apiVersion: v1
kind: ResourceQuota
metadata:
  name: unifiedpushservers-limit
spec:
  hard:
    count/unifiedpushservers.push.aerogear.org: 1
</code></pre>

<p>While this get accepted and created, it seems like the counting doesn't work and I'm able to create more than one instance.</p>

<hr>

<p><strong>Edit:</strong> If I quote the integer value of the field in the spec, like this:</p>

<pre><code>apiVersion: v1
kind: ResourceQuota
metadata:
  name: unifiedpushservers-limit
spec:
  hard:
    count/unifiedpushservers.push.aerogear.org: "1"
</code></pre>

<p>then I get the following error message when trying to create even one instance:</p>

<pre><code>Error from server (Forbidden): error when creating "./deploy/crds/push_v1alpha1_unifiedpushserver_cr.yaml": unifiedpushservers.push.aerogear.org "example-unifiedpushserver" is forbidden: status unknown for quota: unifiedpushservers-limit
</code></pre>

<p>That feels like progress, but I might be getting further away, I'm not sure.</p>

<p>Also, I should mention that I'm trying this on an OpenShift v3.11 cluster, which returns the following Kubernetes version info:</p>

<pre><code>$ kubectl version
Client Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.0+d4cacc0", GitCommit:"d4cacc0", GitTreeState:"clean", BuildDate:"2018-10-10T16:38:01Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.0+d4cacc0", GitCommit:"d4cacc0", GitTreeState:"clean", BuildDate:"2018-11-09T15:12:26Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

grdryn
<p>Since <strong>kubernetes 1.15</strong> Object count quota is now supported for <strong>namespaced custom resources</strong> using the <code>count/&lt;resource&gt;.&lt;group&gt;</code> syntax</p>

<blockquote>
  <p>For example, to create a quota on a widgets custom resource in the example.com API group, use count/widgets.example.com.</p>
</blockquote>

<p><a href="https://kubernetes.io/docs/concepts/policy/resource-quotas/#object-count-quota" rel="noreferrer">object-count-quota</a></p>
