I moved some code from the Cobra Run struct field into reusable functions, so I could call them from the new detect-all-in-cluster command.
What alternative solution should we consider, if any?
Although the detect-all-in-cluster command instantiates both a dynamic Kubernetes client and a Helm client, the only duplicated work is calling our kube.GetConfig() function, but determining the KubeConfig file twice is reasonable, compared to retaining it the first time and passing it around.
Checklist
Description
What's the goal of this PR?
Add a command to Pluto that combines all in-cluster detections - currently
detect-helm
anddetect-api-resources
.Sample Output
What changes did you make?
I moved some code from the Cobra
Run
struct field into reusable functions, so I could call them from the newdetect-all-in-cluster
command.What alternative solution should we consider, if any?
Although the
detect-all-in-cluster
command instantiates both a dynamic Kubernetes client and a Helm client, the only duplicated work is calling our kube.GetConfig() function, but determining the KubeConfig file twice is reasonable, compared to retaining it the first time and passing it around.