1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-05 07:26:55 +00:00

fix: ttl cleanup not working with cluster wide resources (#9060)

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2023-12-03 00:35:13 +01:00 committed by GitHub
parent 296578a456
commit 095b22b6af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -122,7 +122,11 @@ func (c *controller) reconcile(ctx context.Context, logger logr.Logger, itemKey
if err != nil {
return err
}
obj, err := c.lister.ByNamespace(namespace).Get(name)
getter := c.lister.Get
if namespace != "" {
getter = c.lister.ByNamespace(namespace).Get
}
obj, err := getter(name)
if err != nil {
if apierrors.IsNotFound(err) {
// resource doesn't exist anymore, nothing much to do at this point