yonahd / kor

A Golang Tool to discover unused Kubernetes Resources
MIT License
974 stars 91 forks source link

Add finalizer subcommand #172

Closed Yuni-sa closed 8 months ago

Yuni-sa commented 10 months ago

Iterates over all types of namespaced resources in the cluster (Including Custom Resources) check if they are in a terminating state by looking if they have a finalizer and a deletion timestamp, deletion of those resources is also supported by patching out the finalizer.

part of #117

this command is not added to the "all" command for future plans implementing a separate function for the supported resources after #167

codecov-commenter commented 10 months ago

Codecov Report

Attention: 106 lines in your changes are missing coverage. Please review.

Comparison is base (15c865e) 46.33% compared to head (f3b3a3d) 45.87%.

Files Patch % Lines
pkg/kor/finalizers.go 37.50% 46 Missing and 4 partials :warning:
pkg/kor/delete.go 50.87% 25 Missing and 3 partials :warning:
pkg/kor/kor.go 0.00% 28 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #172 +/- ## ========================================== - Coverage 46.33% 45.87% -0.46% ========================================== Files 24 25 +1 Lines 2236 2413 +177 ========================================== + Hits 1036 1107 +71 - Misses 1023 1122 +99 - Partials 177 184 +7 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

yonahd commented 9 months ago

@Yuni-sa is this ready for review?

Yuni-sa commented 9 months ago

Overall it looks good. Can we support this in multi and all and merge the namespaces? Maybe we can do it that way and then put finalizers as include finalizers flag or something like that?

WDYT?

Not sure if there is a good implementation of this without #167 , after reasoning will be added I will create a new pr that will include it in all and multi.

if we add this now it would probably all be deleted/changed in the next pr, I think the current implementation of using kor finalizers which also supports all of the filters options is fine for now.

yonahd commented 9 months ago

Overall it looks good. Can we support this in multi and all and merge the namespaces? Maybe we can do it that way and then put finalizers as include finalizers flag or something like that? WDYT?

Not sure if there is a good implementation of this without #167 , after reasoning will be added I will create a new pr that will include it in all and multi.

if we add this now it would probably all be deleted/changed in the next pr, I think the current implementation of using kor finalizers which also supports all of the filters options is fine for now.

Ok. Can you just add the command in the Readme and then we can merge it