yonahd / kor

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

Feature: In-cluster exporter configuration #218

Closed hrytsai closed 7 months ago

hrytsai commented 8 months ago

Is your feature request related to a problem? Please describe. We run kor outside of the cluster with option provided below and got expected result: list of unused configmaps,secrets and pvc's in namespace kor configmap,secret,persistentvolumeclaim -n kor-test-namespace And now we want to reproduce this scenario but in cluster with export mode.

Describe the solution you'd like Possibility to configure kor to export prometheus metric only from 1 namespace and reduce list of resources, for example only for: configmap,secret,persistentvolumeclaim in "In cluster" mode ? Something like: kor exporter -n columbus-data-platform-dev -r configmap,secret,persistentvolumeclaim (List of included resources, by default it can be: all)

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context We want use kor in environment where each project is isolated in own Project\Namespace in OpenShift 4.x platform and should keep tracking unused resources separately.

Yuni-sa commented 8 months ago

@yonahd can I be assigned to this?

yonahd commented 8 months ago

@Yuni-sa I believe namespaces are already supported, so just resources are missing

Yuni-sa commented 8 months ago

@yonahd ,Yes it seems they do work as intended, I think I would add the functionality using GetUnusedMulti().

what do you think would be better:

kor exporter svc,ing,pod -n namespace or kor exporter -r svc,ing,pod -n namespace

yonahd commented 8 months ago

I actually think the proper setup may be

kor svc, ing -n namespace -exporter

But using our current code we can do it with -r