yonahd / kor

A Golang Tool to discover unused Kubernetes Resources
MIT License
1.04k stars 96 forks source link

Filter flags are not working --older-than , --newer-than #318

Closed sosoriov closed 4 months ago

sosoriov commented 5 months ago

Describe the bug The filter options doesn't seem to work, no matter what pass using one of these 2 , I always get the same (all) resources --older-than , --newer-than

To Reproduce

./kor.exe replicaset --include-namespaces testing --show-reason --older-than=1000h

Expected behavior show only the older replicasets

OS version, architecture and kor version Windows

Yuni-sa commented 5 months ago

in replicaset.go filters.run() is missing the SetObject() method. https://github.com/yonahd/kor/blob/da9b3c2d5788c40929934e00bc2927e52a760558/pkg/kor/replicaset.go#L25 example where its used corrrectly: https://github.com/yonahd/kor/blob/da9b3c2d5788c40929934e00bc2927e52a760558/pkg/kor/hpas.go#L60

I also recommend doing a quick check for other resources that might be missing it.