mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-05 15:37:19 +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:
parent
296578a456
commit
095b22b6af
1 changed files with 5 additions and 1 deletions
|
@ -122,7 +122,11 @@ func (c *controller) reconcile(ctx context.Context, logger logr.Logger, itemKey
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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 err != nil {
|
||||||
if apierrors.IsNotFound(err) {
|
if apierrors.IsNotFound(err) {
|
||||||
// resource doesn't exist anymore, nothing much to do at this point
|
// resource doesn't exist anymore, nothing much to do at this point
|
||||||
|
|
Loading…
Add table
Reference in a new issue