kyverno: [Bug] Kyverno tries to sync pullsecret to the non-existent namespace

Kyverno Version

1.11.0

Kubernetes Version

1.26.x

Kubernetes Platform

Other (Talos)

Kyverno Rule Type

Generate

Description

Hi

There is a problem related to this clusterpolicy https://kyverno.io/policies/other/sync-secrets/sync-secrets/

When an existing namespace is removed in the kubernetes cluster, kyverno tries to sync continously the secret into the removed namespace:

E1204 10:37:17.588437       1 generate.go:368] background "msg"="failed to apply generate rule" "error"="namespaces \"db-313\" not found" "name"="ur-6fkhw" "policy"="sync-pull-secrets" "resource"="db-313" "rule"="sync-image-pull-secret" "suggestion"="users need to grant Kyverno's service account additional privileges"
I1204 10:37:17.588713       1 event_broadcaster.go:318] "Event occurred" object="sync-pull-secrets" kind="ClusterPolicy" apiVersion="kyverno.io/v1" type="Warning" reason="PolicyError" action="None" note="policy sync-pull-secrets-v2/sync-image-pull-secret error: namespaces \"db-313\" not found"

Steps to reproduce

  1. Apply your https://kyverno.io/policies/other/s-z/sync-secrets/sync-secrets/
  2. Create a namespace into the k8s cluster
  3. Wait for syncing the pullSecret
  4. Remove the previously created namespace
  5. Update the pullSecret
  6. Error happening

Expected behavior

Kyverno should detect that the namespace is not existing anymore and avoid to sync to that namespace

Screenshots

No response

Kyverno logs

No response

Slack discussion

No response

Troubleshooting

  • I have read and followed the documentation AND the troubleshooting guide.
  • I have searched other issues in this repository and mine is not recorded.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

Hi, is anyone still working on this?

I am working on it