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

Support finding unused namespaces #102

Closed
wants to merge 2 commits into from

Conversation

liornoy
Copy link

@liornoy liornoy commented Oct 13, 2023

Add a new "namespace" command to find unused namespaces.

This command determines whether there are any used resources
within a given namespace, if there are no used resources,
the namespace is considered unused.

fixes #92

Add a new "namespace" command to find unused namespaces.
This command determines whether there are any used resources
within a given namespace, if there are no used resources,
the namespace is considered unused.

Additionally, unit tests have been added to cover different resource scenarios
and for the Structured function.

Signed-off-by: liornoy <[email protected]>
Updates the README to include the new namespace command.

Signed-off-by: liornoy <[email protected]>
@yonahd
Copy link
Owner

yonahd commented Oct 15, 2023

Hi @liornoy
This is a good direction but this would miss some resources that may be present such a jobs, cron jobs or any other resource kor doesn't track.

@luisdavim
Copy link
Collaborator

Hi @liornoy This is a good direction but this would miss some resources that may be present such a jobs, cron jobs or any other resource kor doesn't track.

Yeah, this may lead to many false positives, one approach could be to get a list of resource types from the user and check if any of those exist in the given namespace, or get a list of namespaced resource types from the API and use that to check the NS. Something like what this plugin does https://github.com/corneliusweig/ketall/tree/master

We also have to take into account the default resources in a namespace, like the default service account and its secret for example.

@liornoy
Copy link
Author

liornoy commented Oct 17, 2023

Thanks for the review @yonahd @luisdavim !
I'll take a look into this ketall tool and rethink my approach here.

@yonahd
Copy link
Owner

yonahd commented Nov 5, 2023

@liornoy Do you intend to retry this MR or should I have someone else attempt it?

@liornoy
Copy link
Author

liornoy commented Nov 6, 2023

@yonahd Hi! please do un-assign me. I can't seem to make this work in the time that I have.

@liornoy liornoy closed this Nov 6, 2023
@yonahd
Copy link
Owner

yonahd commented Nov 7, 2023

Thanks for the attempt!
Hope to see you back here in the future

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.

Find Empty namespaces
3 participants