Documentation ¶
Index ¶
- func CheckRequest(quotas []corev1.ResourceQuota, a admission.Attributes, ...) ([]corev1.ResourceQuota, error)
- func IsDefaultDeny(err error) bool
- type Evaluator
- type QuotaAccessor
- type QuotaAdmission
- func (a *QuotaAdmission) SetExternalKubeClientSet(client kubernetes.Interface)
- func (a *QuotaAdmission) SetExternalKubeInformerFactory(f informers.SharedInformerFactory)
- func (a *QuotaAdmission) SetQuotaConfiguration(c quota.Configuration)
- func (a *QuotaAdmission) Validate(ctx context.Context, attr admission.Attributes, o admission.ObjectInterfaces) (err error)
- func (a *QuotaAdmission) ValidateInitialization() error
- type WantsQuotaConfiguration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckRequest ¶
func CheckRequest(quotas []corev1.ResourceQuota, a admission.Attributes, evaluator quota.Evaluator, limited []resourcequotaapi.LimitedResource) ([]corev1.ResourceQuota, error)
CheckRequest is a static version of quotaEvaluator.checkRequest, possible to be called from outside.
func IsDefaultDeny ¶
IsDefaultDeny returns true if the error is defaultDeny
Types ¶
type Evaluator ¶
type Evaluator interface { // Evaluate takes an operation and checks to see if quota constraints are satisfied. It returns an error if they are not. // The default implementation process related operations in chunks when possible. Evaluate(a admission.Attributes) error }
Evaluator is used to see if quota constraints are satisfied.
func NewQuotaEvaluator ¶
func NewQuotaEvaluator(quotaAccessor QuotaAccessor, ignoredResources map[schema.GroupResource]struct{}, quotaRegistry quota.Registry, lockAcquisitionFunc func([]corev1.ResourceQuota) func(), config *resourcequotaapi.Configuration, workers int, stopCh <-chan struct{}) Evaluator
NewQuotaEvaluator configures an admission controller that can enforce quota constraints using the provided registry. The registry must have the capability to handle group/kinds that are persisted by the server this admission controller is intercepting
type QuotaAccessor ¶
type QuotaAccessor interface { // UpdateQuotaStatus is called to persist final status. This method should write to persistent storage. // An error indicates that write didn't complete successfully. UpdateQuotaStatus(newQuota *corev1.ResourceQuota) error // GetQuotas gets all possible quotas for a given namespace GetQuotas(namespace string) ([]corev1.ResourceQuota, error) }
QuotaAccessor abstracts the get/set logic from the rest of the Evaluator. This could be a test stub, a straight passthrough, or most commonly a series of deconflicting caches.
type QuotaAdmission ¶
QuotaAdmission implements an admission controller that can enforce quota constraints
func NewResourceQuota ¶
func NewResourceQuota(config *resourcequotaapi.Configuration, numEvaluators int, stopCh <-chan struct{}) (*QuotaAdmission, error)
NewResourceQuota configures an admission controller that can enforce quota constraints using the provided registry. The registry must have the capability to handle group/kinds that are persisted by the server this admission controller is intercepting
func (*QuotaAdmission) SetExternalKubeClientSet ¶
func (a *QuotaAdmission) SetExternalKubeClientSet(client kubernetes.Interface)
SetExternalKubeClientSet registers the client into QuotaAdmission
func (*QuotaAdmission) SetExternalKubeInformerFactory ¶
func (a *QuotaAdmission) SetExternalKubeInformerFactory(f informers.SharedInformerFactory)
SetExternalKubeInformerFactory registers an informer factory into QuotaAdmission
func (*QuotaAdmission) SetQuotaConfiguration ¶
func (a *QuotaAdmission) SetQuotaConfiguration(c quota.Configuration)
SetQuotaConfiguration assigns and initializes configuration and evaluator for QuotaAdmission
func (*QuotaAdmission) Validate ¶
func (a *QuotaAdmission) Validate(ctx context.Context, attr admission.Attributes, o admission.ObjectInterfaces) (err error)
Validate makes admission decisions while enforcing quota
func (*QuotaAdmission) ValidateInitialization ¶
func (a *QuotaAdmission) ValidateInitialization() error
ValidateInitialization ensures an authorizer is set.
type WantsQuotaConfiguration ¶
type WantsQuotaConfiguration interface { SetQuotaConfiguration(quota.Configuration) admission.InitializationValidator }
WantsQuotaConfiguration defines a function which sets quota configuration for admission plugins that need it.