...

Source file src/github.com/openshift/api/quota/v1/types.go

Documentation: github.com/openshift/api/quota/v1

     1  package v1
     2  
     3  import (
     4  	corev1 "k8s.io/api/core/v1"
     5  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     6  )
     7  
     8  // +genclient
     9  // +genclient:nonNamespaced
    10  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    11  
    12  // ClusterResourceQuota mirrors ResourceQuota at a cluster scope.  This object is easily convertible to
    13  // synthetic ResourceQuota object to allow quota evaluation re-use.
    14  //
    15  // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
    16  // +openshift:compatibility-gen:level=1
    17  type ClusterResourceQuota struct {
    18  	metav1.TypeMeta `json:",inline"`
    19  
    20  	// metadata is the standard object's metadata.
    21  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    22  	metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
    23  
    24  	// Spec defines the desired quota
    25  	Spec ClusterResourceQuotaSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
    26  
    27  	// Status defines the actual enforced quota and its current usage
    28  	Status ClusterResourceQuotaStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
    29  }
    30  
    31  // ClusterResourceQuotaSpec defines the desired quota restrictions
    32  type ClusterResourceQuotaSpec struct {
    33  	// Selector is the selector used to match projects.
    34  	// It should only select active projects on the scale of dozens (though it can select
    35  	// many more less active projects).  These projects will contend on object creation through
    36  	// this resource.
    37  	Selector ClusterResourceQuotaSelector `json:"selector" protobuf:"bytes,1,opt,name=selector"`
    38  
    39  	// Quota defines the desired quota
    40  	Quota corev1.ResourceQuotaSpec `json:"quota" protobuf:"bytes,2,opt,name=quota"`
    41  }
    42  
    43  // ClusterResourceQuotaSelector is used to select projects.  At least one of LabelSelector or AnnotationSelector
    44  // must present.  If only one is present, it is the only selection criteria.  If both are specified,
    45  // the project must match both restrictions.
    46  type ClusterResourceQuotaSelector struct {
    47  	// LabelSelector is used to select projects by label.
    48  	// +optional
    49  	// +nullable
    50  	LabelSelector *metav1.LabelSelector `json:"labels" protobuf:"bytes,1,opt,name=labels"`
    51  
    52  	// AnnotationSelector is used to select projects by annotation.
    53  	// +optional
    54  	// +nullable
    55  	AnnotationSelector map[string]string `json:"annotations" protobuf:"bytes,2,rep,name=annotations"`
    56  }
    57  
    58  // ClusterResourceQuotaStatus defines the actual enforced quota and its current usage
    59  type ClusterResourceQuotaStatus struct {
    60  	// Total defines the actual enforced quota and its current usage across all projects
    61  	Total corev1.ResourceQuotaStatus `json:"total" protobuf:"bytes,1,opt,name=total"`
    62  
    63  	// Namespaces slices the usage by project.  This division allows for quick resolution of
    64  	// deletion reconciliation inside of a single project without requiring a recalculation
    65  	// across all projects.  This can be used to pull the deltas for a given project.
    66  	// +optional
    67  	// +nullable
    68  	Namespaces ResourceQuotasStatusByNamespace `json:"namespaces" protobuf:"bytes,2,rep,name=namespaces"`
    69  }
    70  
    71  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    72  
    73  // ClusterResourceQuotaList is a collection of ClusterResourceQuotas
    74  //
    75  // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
    76  // +openshift:compatibility-gen:level=1
    77  type ClusterResourceQuotaList struct {
    78  	metav1.TypeMeta `json:",inline"`
    79  
    80  	// metadata is the standard list's metadata.
    81  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    82  	metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
    83  
    84  	// Items is a list of ClusterResourceQuotas
    85  	Items []ClusterResourceQuota `json:"items" protobuf:"bytes,2,rep,name=items"`
    86  }
    87  
    88  // ResourceQuotasStatusByNamespace bundles multiple ResourceQuotaStatusByNamespace
    89  type ResourceQuotasStatusByNamespace []ResourceQuotaStatusByNamespace
    90  
    91  // ResourceQuotaStatusByNamespace gives status for a particular project
    92  type ResourceQuotaStatusByNamespace struct {
    93  	// Namespace the project this status applies to
    94  	Namespace string `json:"namespace" protobuf:"bytes,1,opt,name=namespace"`
    95  
    96  	// Status indicates how many resources have been consumed by this project
    97  	Status corev1.ResourceQuotaStatus `json:"status" protobuf:"bytes,2,opt,name=status"`
    98  }
    99  
   100  // +genclient
   101  // +genclient:onlyVerbs=get,list
   102  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   103  
   104  // AppliedClusterResourceQuota mirrors ClusterResourceQuota at a project scope, for projection
   105  // into a project.  It allows a project-admin to know which ClusterResourceQuotas are applied to
   106  // his project and their associated usage.
   107  //
   108  // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
   109  // +openshift:compatibility-gen:level=1
   110  type AppliedClusterResourceQuota struct {
   111  	metav1.TypeMeta `json:",inline"`
   112  
   113  	// metadata is the standard object's metadata.
   114  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   115  	metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
   116  
   117  	// Spec defines the desired quota
   118  	Spec ClusterResourceQuotaSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
   119  
   120  	// Status defines the actual enforced quota and its current usage
   121  	Status ClusterResourceQuotaStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
   122  }
   123  
   124  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   125  
   126  // AppliedClusterResourceQuotaList is a collection of AppliedClusterResourceQuotas
   127  //
   128  // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
   129  // +openshift:compatibility-gen:level=1
   130  type AppliedClusterResourceQuotaList struct {
   131  	metav1.TypeMeta `json:",inline"`
   132  
   133  	// metadata is the standard list's metadata.
   134  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   135  	metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   136  
   137  	// Items is a list of AppliedClusterResourceQuota
   138  	Items []AppliedClusterResourceQuota `json:"items" protobuf:"bytes,2,rep,name=items"`
   139  }
   140  

View as plain text