• Kubernetes Submit Queue's avatar
    Merge pull request #36765 from derekwaynecarr/quota-precious-resources · 506950ad
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue (batch tested with PRs 41421, 41440, 36765, 41722)
    
    ResourceQuota ability to support default limited resources
    
    Add support for the ability to configure the quota system to identify specific resources that are limited by default.  A limited resource means its consumption is denied absent a covering quota.  This is in contrast to the current behavior where consumption is unlimited absent a covering quota.  Intended use case is to allow operators to restrict consumption of high-cost resources by default.
    
    Example configuration:
    
    **admission-control-config-file.yaml**
    ```
    apiVersion: apiserver.k8s.io/v1alpha1
    kind: AdmissionConfiguration
    plugins:
    - name: "ResourceQuota"
      configuration:
        apiVersion: resourcequota.admission.k8s.io/v1alpha1
        kind: Configuration
        limitedResources:
        - resource: pods
          matchContains:
          - pods
          - requests.cpu
        - resource: persistentvolumeclaims
          matchContains:
          - .storageclass.storage.k8s.io/requests.storage
    ```
    
    In the above configuration, if a namespace lacked a quota for any of the following:
    * cpu
    * any pvc associated with particular storage class
    
    The attempt to consume the resource is denied with a message stating the user has insufficient quota for the matching resources.
    
    ```
    $ kubectl create -f pvc-gold.yaml 
    Error from server: error when creating "pvc-gold.yaml": insufficient quota to consume: gold.storageclass.storage.k8s.io/requests.storage
    $ kubectl create quota quota --hard=gold.storageclass.storage.k8s.io/requests.storage=10Gi
    $ kubectl create -f pvc-gold.yaml 
    ... created
    ```
    506950ad
Name
Last commit
Last update
..
admission Loading commit data...
auth Loading commit data...
scheduler Loading commit data...