Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // SUPPORTED_OPERATING_MODES contains all supported operating modes. Used for validation. SUPPORTED_OPERATING_MODES = []QuotaIncreaseOperatingMode{CUMULATIVE, MAXIMUM, SINGULAR} )
Functions ¶
func Validate ¶
func Validate(cfg *QuotaControllerConfig) error
Validate validates the QuotaController configuration. This is equivalent to ValidateRaw().ToAggregate().
func ValidateRaw ¶
func ValidateRaw(cfg *QuotaControllerConfig) field.ErrorList
ValidateRaw works like validate, but it returns a list of errors instead of an aggregated one.
Types ¶
type QuotaControllerConfig ¶
type QuotaControllerConfig struct { // ExternalQuotaDefinitionNames contains the names of the QuotaDefinitions that are managed by other QuotaControllers running in the same cluster. // This is used to make sure that only one controller tries to manage a given namespace. // If only one QuotaController is running in the cluster, this should be left empty. // +optional ExternalQuotaDefinitionNames []string `json:"externalQuotaDefinitionNames,omitempty"` // Quotas is a list of QuotaDefinitions. Quotas []*QuotaDefinition `json:"quotas"` }
func LoadConfig ¶
func LoadConfig(path string) (*QuotaControllerConfig, error)
LoadConfig reads the configuration file from a given path and parses it into a QuotaControllerConfig object.
func (*QuotaControllerConfig) GetActiveQuotaDefinitions ¶
func (cfg *QuotaControllerConfig) GetActiveQuotaDefinitions() sets.Set[string]
GetActiveQuotaDefinitions returns the set of known active QuotaDefinitions.
type QuotaDefinition ¶
type QuotaDefinition struct { // Name is the identifier for this quota definition. Name string `json:"name"` // Selector is a label selector that specifies which namespaces this quota definition should be applied to. // If nil, all namespaces are selected. // +optional Selector *metav1.LabelSelector `json:"selector"` // ResourceQuotaTemplate is the template for the ResourceQuota that should be created for all namespaces which match the selector. ResourceQuotaTemplate *ResourceQuotaTemplate `json:"template"` // Mode is the mode in which the quota should be increased. // cumulative: multiple quota increases for the same resource will add up. // maximum: the highest quota increase for the same resource will be used. // singular: only one quota increase for the same resource will be used (specified via label on the namespace). Mode QuotaIncreaseOperatingMode `json:"mode"` // DeleteIneffectiveQuotas specifies whether ResourceQuotas that are no longer effective should be deleted automatically. // +optional DeleteIneffectiveQuotas bool `json:"deleteIneffectiveQuotas,omitempty"` }
func (*QuotaDefinition) BaseResourceQuota ¶
func (d *QuotaDefinition) BaseResourceQuota() *corev1.ResourceQuota
BaseResourceQuota returns a ResourceQuota object based on the configured template. A deep copy is returned, the returned object can be modified without affecting the original template. Note that the namespace is missing and has to be set afterwards.
func (*QuotaDefinition) DeepCopy ¶
func (d *QuotaDefinition) DeepCopy() *QuotaDefinition
type QuotaIncreaseOperatingMode ¶
type QuotaIncreaseOperatingMode string
const ( // CUMULATIVE means that multiple quota increases for the same resource will add up. CUMULATIVE QuotaIncreaseOperatingMode = "cumulative" // MAXIMUM means that the highest quota increase for the same resource will be used. MAXIMUM QuotaIncreaseOperatingMode = "maximum" // SINGULAR means that only one quota increase for the same resource will be used. SINGULAR QuotaIncreaseOperatingMode = "singular" )
type ResourceQuotaTemplate ¶
type ResourceQuotaTemplate struct { // Annotations are the annotations that should be added to the generated ResourceQuota. Annotations map[string]string `json:"annotations,omitempty"` // Labels are the labels that should be added to the generated ResourceQuota. Labels map[string]string `json:"labels,omitempty"` // Spec is the spec of the generated ResourceQuota. Spec *corev1.ResourceQuotaSpec `json:"spec"` }
func (*ResourceQuotaTemplate) DeepCopy ¶
func (t *ResourceQuotaTemplate) DeepCopy() *ResourceQuotaTemplate
Click to show internal directories.
Click to hide internal directories.