Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: refactored mismatching deletion resource types #201

Merged
merged 2 commits into from
Feb 3, 2024

Conversation

doronkg
Copy link
Contributor

@doronkg doronkg commented Feb 3, 2024

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:

  • delete.go -> changed Roles to Role to match passed resource-type in roles.go.
  • serviceaccountss.go -> changed Serviceaccount to ServiceAccount.
  • statefulsets.go -> changed Statefulset to StatefulSet.

@codecov-commenter
Copy link

codecov-commenter commented Feb 3, 2024

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 ⚠️
pkg/kor/serviceaccounts.go 0.00% 1 Missing ⚠️
pkg/kor/statefulsets.go 0.00% 1 Missing ⚠️

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

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #201   +/-   ##
=======================================
  Coverage   44.43%   44.43%           
=======================================
  Files          29       29           
  Lines        2444     2444           
=======================================
  Hits         1086     1086           
  Misses       1205     1205           
  Partials      153      153           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@yonahd yonahd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catches
Thanks!

@yonahd yonahd merged commit 2fd9118 into yonahd:main Feb 3, 2024
1 check passed
@doronkg doronkg deleted the fix/broken-resources-deletions branch February 3, 2024 20:21
@doronkg doronkg mentioned this pull request Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken Role/SA/STS Deletion
3 participants