yonahd / kor

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

Fix: refactored mismatching deletion resource types #201

Closed doronkg closed 8 months ago

doronkg commented 8 months ago

In cases where the resource type name mismatches in the following funcs, its deletion functionality will break:

# pkg/kor/<resource>s.go

func GetUnused<Resource>s()
    if opts.DeleteFlag {
          if diff, err = DeleteResource(diff, clientset, namespace, "<Resource>", opts.NoInteractive); err != nil {

# pkg/kor/delete.go

func DeleteResourceCmd()
        "<Resource>": func(clientset kubernetes.Interface, namespace, name string) error {

I've fixed the following mismatches in order to resolve #200:

codecov-commenter commented 8 months ago

Codecov Report

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

Comparison is base (47ec5b8) 44.43% compared to head (a34b248) 44.43%.

Files Patch % Lines
pkg/kor/delete.go 0.00% 3 Missing :warning:
pkg/kor/serviceaccounts.go 0.00% 1 Missing :warning:
pkg/kor/statefulsets.go 0.00% 1 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 #201 +/- ## ======================================= Coverage 44.43% 44.43% ======================================= Files 29 29 Lines 2444 2444 ======================================= Hits 1086 1086 Misses 1205 1205 Partials 153 153 ```

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