mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
fix: remove explicit wait for cache sync (#4791)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com> Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
This commit is contained in:
parent
5f3411e588
commit
59f11f08b3
3 changed files with 2 additions and 18 deletions
|
@ -28,8 +28,6 @@ type Controller interface {
|
|||
type controller struct {
|
||||
renewer *tls.CertRenewer
|
||||
secretLister corev1listers.SecretLister
|
||||
// secretSynced returns true if the secret shared informer has synced at least once
|
||||
secretSynced cache.InformerSynced
|
||||
secretQueue chan bool
|
||||
}
|
||||
|
||||
|
@ -37,7 +35,6 @@ func NewController(secretInformer corev1informers.SecretInformer, certRenewer *t
|
|||
manager := &controller{
|
||||
renewer: certRenewer,
|
||||
secretLister: secretInformer.Lister(),
|
||||
secretSynced: secretInformer.Informer().HasSynced,
|
||||
secretQueue: make(chan bool, 1),
|
||||
}
|
||||
secretInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
corev1informers "k8s.io/client-go/informers/core/v1"
|
||||
corev1listers "k8s.io/client-go/listers/core/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
)
|
||||
|
||||
|
@ -26,9 +25,6 @@ type controller struct {
|
|||
// listers
|
||||
configmapLister corev1listers.ConfigMapLister
|
||||
|
||||
// configmapSynced returns true if the configmap shared informer has synced at least once
|
||||
configmapSynced cache.InformerSynced
|
||||
|
||||
// queue
|
||||
queue workqueue.RateLimitingInterface
|
||||
}
|
||||
|
@ -39,14 +35,12 @@ func NewController(configuration config.Configuration, configmapInformer corev1i
|
|||
configmapLister: configmapInformer.Lister(),
|
||||
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), controllerName),
|
||||
}
|
||||
|
||||
c.configmapSynced = configmapInformer.Informer().HasSynced
|
||||
controllerutils.AddDefaultEventHandlers(logger.V(3), configmapInformer.Informer(), c.queue)
|
||||
return &c
|
||||
}
|
||||
|
||||
func (c *controller) Run(ctx context.Context, workers int) {
|
||||
controllerutils.Run(ctx, controllerName, logger.V(3), c.queue, workers, maxRetries, c.reconcile, c.configmapSynced)
|
||||
controllerutils.Run(ctx, controllerName, logger.V(3), c.queue, workers, maxRetries, c.reconcile)
|
||||
}
|
||||
|
||||
func (c *controller) reconcile(ctx context.Context, logger logr.Logger, key, namespace, name string) error {
|
||||
|
|
|
@ -35,11 +35,6 @@ type controller struct {
|
|||
cpolLister kyvernov1listers.ClusterPolicyLister
|
||||
polLister kyvernov1listers.PolicyLister
|
||||
|
||||
// cpolSynced returns true if the cluster policy shared informer has synced at least once
|
||||
cpolSynced cache.InformerSynced
|
||||
// polSynced returns true if the policy shared informer has synced at least once
|
||||
polSynced cache.InformerSynced
|
||||
|
||||
// queue
|
||||
queue workqueue.RateLimitingInterface
|
||||
}
|
||||
|
@ -49,8 +44,6 @@ func NewController(pcache pcache.Cache, cpolInformer kyvernov1informers.ClusterP
|
|||
cache: pcache,
|
||||
cpolLister: cpolInformer.Lister(),
|
||||
polLister: polInformer.Lister(),
|
||||
cpolSynced: cpolInformer.Informer().HasSynced,
|
||||
polSynced: polInformer.Informer().HasSynced,
|
||||
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), controllerName),
|
||||
}
|
||||
controllerutils.AddDefaultEventHandlers(logger.V(3), cpolInformer.Informer(), c.queue)
|
||||
|
@ -88,7 +81,7 @@ func (c *controller) WarmUp() error {
|
|||
}
|
||||
|
||||
func (c *controller) Run(ctx context.Context, workers int) {
|
||||
controllerutils.Run(ctx, controllerName, logger.V(3), c.queue, workers, maxRetries, c.reconcile, c.cpolSynced, c.polSynced)
|
||||
controllerutils.Run(ctx, controllerName, logger.V(3), c.queue, workers, maxRetries, c.reconcile)
|
||||
}
|
||||
|
||||
func (c *controller) reconcile(ctx context.Context, logger logr.Logger, key, namespace, name string) error {
|
||||
|
|
Loading…
Reference in a new issue