mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 06:15:45 +00:00
reintroduce resourcequota.NewMonitor
- this function is used by other packages and was mistakenly removed
in 397cc73dc9
- let resource quota controller use this constructor instead of an
object instantiation
This commit is contained in:
parent
7dcb412675
commit
c816601d83
@ -151,16 +151,15 @@ func NewController(ctx context.Context, options *ControllerOptions) (*Controller
|
|||||||
)
|
)
|
||||||
|
|
||||||
if options.DiscoveryFunc != nil {
|
if options.DiscoveryFunc != nil {
|
||||||
qm := &QuotaMonitor{
|
qm := NewMonitor(
|
||||||
informersStarted: options.InformersStarted,
|
options.InformersStarted,
|
||||||
informerFactory: options.InformerFactory,
|
options.InformerFactory,
|
||||||
ignoredResources: options.IgnoredResourcesFunc(),
|
options.IgnoredResourcesFunc(),
|
||||||
resourceChanges: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "resource_quota_controller_resource_changes"),
|
options.ReplenishmentResyncPeriod,
|
||||||
resyncPeriod: options.ReplenishmentResyncPeriod,
|
rq.replenishQuota,
|
||||||
replenishmentFunc: rq.replenishQuota,
|
rq.registry,
|
||||||
registry: rq.registry,
|
options.UpdateFilter,
|
||||||
updateFilter: options.UpdateFilter,
|
)
|
||||||
}
|
|
||||||
|
|
||||||
rq.quotaMonitor = qm
|
rq.quotaMonitor = qm
|
||||||
|
|
||||||
|
@ -103,6 +103,20 @@ type QuotaMonitor struct {
|
|||||||
updateFilter UpdateFilter
|
updateFilter UpdateFilter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewMonitor creates a new instance of a QuotaMonitor
|
||||||
|
func NewMonitor(informersStarted <-chan struct{}, informerFactory informerfactory.InformerFactory, ignoredResources map[schema.GroupResource]struct{}, resyncPeriod controller.ResyncPeriodFunc, replenishmentFunc ReplenishmentFunc, registry quota.Registry, updateFilter UpdateFilter) *QuotaMonitor {
|
||||||
|
return &QuotaMonitor{
|
||||||
|
informersStarted: informersStarted,
|
||||||
|
informerFactory: informerFactory,
|
||||||
|
ignoredResources: ignoredResources,
|
||||||
|
resourceChanges: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "resource_quota_controller_resource_changes"),
|
||||||
|
resyncPeriod: resyncPeriod,
|
||||||
|
replenishmentFunc: replenishmentFunc,
|
||||||
|
registry: registry,
|
||||||
|
updateFilter: updateFilter,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// monitor runs a Controller with a local stop channel.
|
// monitor runs a Controller with a local stop channel.
|
||||||
type monitor struct {
|
type monitor struct {
|
||||||
controller cache.Controller
|
controller cache.Controller
|
||||||
|
Loading…
Reference in New Issue
Block a user