mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-15 17:51:20 +00:00
fix: record configmap resource version to not reload when version didn't change (#7007)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
parent
8d52c1366b
commit
cc66f2e402
1 changed files with 14 additions and 5 deletions
|
@ -40,10 +40,11 @@ type controller struct {
|
|||
queue workqueue.RateLimitingInterface
|
||||
|
||||
// config
|
||||
controllerName string
|
||||
logger logr.Logger
|
||||
name string
|
||||
callback callback
|
||||
controllerName string
|
||||
logger logr.Logger
|
||||
name string
|
||||
callback callback
|
||||
resourceVersion string
|
||||
}
|
||||
|
||||
type callback func(context.Context, *corev1.ConfigMap) error
|
||||
|
@ -104,5 +105,13 @@ func (c *controller) doReconcile(ctx context.Context, logger logr.Logger) error
|
|||
}
|
||||
return c.callback(ctx, nil)
|
||||
}
|
||||
return c.callback(ctx, observed)
|
||||
if c.resourceVersion == observed.ResourceVersion {
|
||||
return nil
|
||||
}
|
||||
if err := c.callback(ctx, observed); err != nil {
|
||||
return err
|
||||
}
|
||||
// record resource version
|
||||
c.resourceVersion = observed.ResourceVersion
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue