nikhilsbhat / helm-drift

Helm plugin that identifies the configuration that has drifted from the Helm chart
https://artifacthub.io/packages/helm-plugin/helm-drift/drift
MIT License
62 stars 8 forks source link

Fails to identify multiple kubeconfig files #15

Closed hjpotter92 closed 6 months ago

hjpotter92 commented 7 months ago

I've multiple clusters, split across several kubeconfig files. kubectl is able to handle these without issues with a kubeconfig env. var as follows:

KUBECONFIG="/infra/.kube/k8s.local:/infra/.kube/k8s.vault"

and i've not faced issue with this in other helm plugins i'm using (helm-dashboard). i wanted to give helm-drift a try, but it seems it fails to identify multiple kubeconfig files, and reports:

{"level":"fatal","msg":"calculating diff errored with: running kubectl diff errored with exit code: exit status 2 ,with message: error: stat /infra/.kube/k8s.local:/infra/.kube/k8s.vault: no such file or directory\n\nrunning kubectl diff errored with exit code: exit status 2 ,with message: error: stat /infra/.kube/k8s.local:/infra/.kube/k8s.vault: no such file or directory\n\nrunning kubectl diff errored with exit code: exit status 2 ,with message: error: stat /infra/.kube/k8s.local:/infra/.kube/k8s.vault: no such file or directory\n","time":"2024-02-14T09:09:37Z"}
nikhilsbhat commented 7 months ago

@hjpotter92, the value set under KUBECONFIG would be set to flag --kubeconfig while invoking kubectl diff internally. I guess, setting the value containing multiple paths to --kubeconfig is not working.

Can you share logs by enabling log level to debug.

Also i'll try to reproduce this in my local for debugging.

nikhilsbhat commented 6 months ago

@hjpotter92, As I mentioned above, we cannot pass the multiple files defined under environment variable KUBECONFIG to flag --kubeconfig; it just fails. Hence, I have added the validation to error out in such situations.