argoproj / argo-events

Event-driven Automation Framework for Kubernetes
https://argoproj.github.io/argo-events/
Apache License 2.0
2.38k stars 741 forks source link

Unable to delete cluster-scoped resources with the Kubernetes object trigger #3300

Closed tvandinther closed 3 weeks ago

tvandinther commented 1 month ago

Describe the bug When using the Kubernetes object trigger to delete a cluster-scoped resource (such as a persistent volume), the message object not found, nothing to delete... is logged.

To Reproduce Delete any cluster-scoped resource (other than namespace or node) using the Kubernetes object trigger.

Expected behavior The resource should be identified as cluster-scoped and found and deleted appropriately.

Environment (please complete the following information):

Additional context It is possible this issue affects operations other than Delete. I noticed that in this part of the code, only namespaces and nodes are listed as cluster-scoped resources. Following a static analysis of the code, I presume the namespace is set to the sensor namespace and subsequently not found.

I'd expect that this issue is fixed by making the list exhaustive (for standard resources), or a new mechanism used to determine cluster-scoped resources so that cluster-scoped CRs can also be identified.


Message from the maintainers:

If you wish to see this enhancement implemented please add a 👍 reaction to this issue! We often sort issues this way to know what to prioritize.

tvandinther commented 1 month ago

This may be fixed upstream if the dynamic client is amended to find cluster-scoped resources even when a namespace is set as per this issue: https://github.com/kubernetes/kubernetes/issues/111248

It also seems that this stale issue covers the same problem: https://github.com/argoproj/argo-events/issues/3132

whynowy commented 1 month ago

This may be fixed upstream if the dynamic client is amended to find cluster-scoped resources even when a namespace is set as per this issue: kubernetes/kubernetes#111248

It also seems that this stale issue covers the same problem: #3132

Would you like to submit a PR to add those (maybe not all but often used) cluster scope resources?

tvandinther commented 1 month ago

If you're happy with that approach I can submit the PR.