Open enisoc opened 2 years ago
Thanks for reporting this. Your assumptions about the reason for this issue are correct: https://github.com/helm/helm/issues/7862
I wish more folks would link to this issue, so Helm maintainers may understand that this is not what users expect at all.
Perhaps as a workaround, vcluster could execute helm with its working dir set to a temp dir whose contents are known?
@enisoc yes thats true, we could do that
@enisoc If you want to contribute this improvement, take a look how I did the same thing over here: https://github.com/loft-sh/loftctl/blob/master/pkg/clihelper/clihelper.go#L687
Note that --values files need to be rewritten to absolute paths first.
Changing the working directory might cause other issues, e.g. relative paths in the env vars such as KUBECONFIG, etc. I am not sure what's the best way to solve this. As an immediate improvement, we can print a helpful error message that should make it easy for the user to work around this problem. :) The new error message is added in this PR - #285, and it looks like this:
[fatal] Aborting vcluster creation. Current working directory contains a file or a directory with the name equal to the vcluster chart name - "vcluster". Please execute vcluster create command from a directory that doesn't contain a file or directory named "vcluster".
I got a strange error when I tried to run
vcluster create
:It turned out this is because I was running
vcluster
from the working directory that contained thevcluster
binary itself. It seems that Helm prefers the local file if it exists, instead of treatingvcluster
as referring to a chart within thecharts.loft.sh
repo. Helm then tries to load thevcluster
file as if it's a chart archive.Here is a minimal reproduction case:
A directory called
vcluster
causes a similar but slightly different error: