1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

fix: use deleteOptions in cleanup controller (#11662)

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2024-11-25 11:48:58 +01:00 committed by GitHub
parent 70b50d755a
commit be4705faa3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -309,7 +309,7 @@ func (c *controller) cleanup(ctx context.Context, logger logr.Logger, policy kyv
labels = append(labels, attribute.String("deletion_policy", string(*deleteOptions.PropagationPolicy)))
}
logger.WithValues("name", name, "namespace", namespace).Info("resource matched, it will be deleted...")
if err := c.client.DeleteResource(ctx, resource.GetAPIVersion(), resource.GetKind(), namespace, name, false, metav1.DeleteOptions{}); err != nil {
if err := c.client.DeleteResource(ctx, resource.GetAPIVersion(), resource.GetKind(), namespace, name, false, deleteOptions); err != nil {
if c.metrics.cleanupFailuresTotal != nil {
c.metrics.cleanupFailuresTotal.Add(ctx, 1, metric.WithAttributes(labels...))
}