mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-20 09:33:52 +00:00
resourcequota: use dynamic informer
The resource quota controller should use a dynamic informer so it can create informer for custom resources.
This commit is contained in:
@@ -32,7 +32,6 @@ go_library(
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/discovery:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/informers:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/informers/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
|
||||
|
@@ -35,7 +35,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/client-go/discovery"
|
||||
"k8s.io/client-go/informers"
|
||||
coreinformers "k8s.io/client-go/informers/core/v1"
|
||||
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
corelisters "k8s.io/client-go/listers/core/v1"
|
||||
@@ -52,12 +51,6 @@ type NamespacedResourcesFunc func() ([]*metav1.APIResourceList, error)
|
||||
// that may require quota to be recalculated.
|
||||
type ReplenishmentFunc func(groupResource schema.GroupResource, namespace string)
|
||||
|
||||
// InformerFactory is all the quota system needs to interface with informers.
|
||||
type InformerFactory interface {
|
||||
ForResource(resource schema.GroupVersionResource) (informers.GenericInformer, error)
|
||||
Start(stopCh <-chan struct{})
|
||||
}
|
||||
|
||||
// ResourceQuotaControllerOptions holds options for creating a quota controller
|
||||
type ResourceQuotaControllerOptions struct {
|
||||
// Must have authority to list all quotas, and update quota status
|
||||
@@ -75,7 +68,7 @@ type ResourceQuotaControllerOptions struct {
|
||||
// InformersStarted knows if informers were started.
|
||||
InformersStarted <-chan struct{}
|
||||
// InformerFactory interfaces with informers.
|
||||
InformerFactory InformerFactory
|
||||
InformerFactory controller.InformerFactory
|
||||
// Controls full resync of objects monitored for replenishment.
|
||||
ReplenishmentResyncPeriod controller.ResyncPeriodFunc
|
||||
}
|
||||
|
@@ -86,7 +86,7 @@ type QuotaMonitor struct {
|
||||
resourceChanges workqueue.RateLimitingInterface
|
||||
|
||||
// interfaces with informers
|
||||
informerFactory InformerFactory
|
||||
informerFactory controller.InformerFactory
|
||||
|
||||
// list of resources to ignore
|
||||
ignoredResources map[schema.GroupResource]struct{}
|
||||
@@ -101,7 +101,7 @@ type QuotaMonitor struct {
|
||||
registry quota.Registry
|
||||
}
|
||||
|
||||
func NewQuotaMonitor(informersStarted <-chan struct{}, informerFactory InformerFactory, ignoredResources map[schema.GroupResource]struct{}, resyncPeriod controller.ResyncPeriodFunc, replenishmentFunc ReplenishmentFunc, registry quota.Registry) *QuotaMonitor {
|
||||
func NewQuotaMonitor(informersStarted <-chan struct{}, informerFactory controller.InformerFactory, ignoredResources map[schema.GroupResource]struct{}, resyncPeriod controller.ResyncPeriodFunc, replenishmentFunc ReplenishmentFunc, registry quota.Registry) *QuotaMonitor {
|
||||
return &QuotaMonitor{
|
||||
informersStarted: informersStarted,
|
||||
informerFactory: informerFactory,
|
||||
|
Reference in New Issue
Block a user