hall / kubenix

Kubernetes management with Nix
https://kubenix.org/
MIT License
319 stars 30 forks source link

Fix Bash expansion in kubeconfig path of CLI script #63

Closed pizzapim closed 6 months ago

pizzapim commented 6 months ago

Previous change had a regression where $HOME in kubernetes.kubeconfig would be expanded at build-time. This is because --set KUBECONFIG "${kubeconfig}" (where kubeconfig = "$HOME/.kube/config") would evaluate to --set KUBECONFIG "/home/homeless-shelter/.kube/config" at build-time.

We also cannot do --set KUBECONFIG '${kubeconfig}' because wrapProgram renders this as export KUBECONFIG='$HOME/.kube/config'. Note the single quotes, which prevents expansion of $HOME.

A solution here is to avoid using --set altogether and use --run with any quotes instead, which allows to expand ~ as well.