type NamespacedResourcesFunc … type ReplenishmentFunc … type ControllerOptions … type Controller … // NewController creates a quota controller with specified options func NewController(ctx context.Context, options *ControllerOptions) (*Controller, error) { … } // enqueueAll is called at the fullResyncPeriod interval to force a full recalculation of quota usage statistics func (rq *Controller) enqueueAll(ctx context.Context) { … } // obj could be an *v1.ResourceQuota, or a DeletionFinalStateUnknown marker item. func (rq *Controller) enqueueResourceQuota(logger klog.Logger, obj interface{ … } func (rq *Controller) addQuota(logger klog.Logger, obj interface{ … } // worker runs a worker thread that just dequeues items, processes them, and marks them done. func (rq *Controller) worker(queue workqueue.TypedRateLimitingInterface[string]) func(context.Context) { … } // Run begins quota controller using the specified number of workers func (rq *Controller) Run(ctx context.Context, workers int) { … } // syncResourceQuotaFromKey syncs a quota key func (rq *Controller) syncResourceQuotaFromKey(ctx context.Context, key string) (err error) { … } // syncResourceQuota runs a complete sync of resource quota status across all known kinds func (rq *Controller) syncResourceQuota(ctx context.Context, resourceQuota *v1.ResourceQuota) (err error) { … } // replenishQuota is a replenishment function invoked by a controller to notify that a quota should be recalculated func (rq *Controller) replenishQuota(ctx context.Context, groupResource schema.GroupResource, namespace string) { … } // Sync periodically resyncs the controller when new resources are observed from discovery. func (rq *Controller) Sync(ctx context.Context, discoveryFunc NamespacedResourcesFunc, period time.Duration) { … } // printDiff returns a human-readable summary of what resources were added and removed func printDiff(oldResources, newResources map[schema.GroupVersionResource]struct{ … } // waitForStopOrTimeout returns a stop channel that closes when the provided stop channel closes or when the specified timeout is reached func waitForStopOrTimeout(stopCh <-chan struct{ … } // resyncMonitors starts or stops quota monitors as needed to ensure that all // (and only) those resources present in the map are monitored. func (rq *Controller) resyncMonitors(ctx context.Context, resources map[schema.GroupVersionResource]struct{ … } // GetQuotableResources returns all resources that the quota system should recognize. // It requires a resource supports the following verbs: 'create','list','delete' // This function may return both results and an error. If that happens, it means that the discovery calls were only // partially successful. A decision about whether to proceed or not is left to the caller. func GetQuotableResources(discoveryFunc NamespacedResourcesFunc) (map[schema.GroupVersionResource]struct{ … }