yogeshkk / K8sPurger

Hunt Unused Resources In Kubernetes
Apache License 2.0
254 stars 27 forks source link

Unused Services Bug #11

Closed efossas closed 3 years ago

efossas commented 3 years ago

All of my services are returned as unused, as well as ingresses. The issue is this:

When the GetUsedServices(v1) function is run, it updates the local variable UsedEP, not the global variable of UsedEP. The global variable remains an empty list and so when the difference is calculated between EP and UsedEP, the entire EP list is returned.

A simple fix to this is to set UsedEP when GetUsedServices(v1) is called here: https://github.com/yogeshkk/K8sPurger/blob/main/K8sPurger.py#L44

As in, update it to this: UsedEP = GetUsedServices(v1)

I can create a PR if you want, but because the change is so small, you might want to just fix this yourself.

Great project btw

yogeshkk commented 3 years ago

@efossas

Thanks for kind words also for bug.

Yes. Look like when I rearrange project moved from global to local variable but somehow missed this. Yes I will fix it tomorrow morning.

Thanks, Yogesh

yogeshkk commented 3 years ago

Patched in new release. closing the issue.