flux2: flux fails to bootstrap a repo in a different Windows drive than the one in $env:TEMP
Describe the bug
When trying to bootstrap a new flux repository on Windows, if the target directory is in a different drive than $env:TEMP, flux will fail to bootstrap it, with the error below:
github.com/pellegrino/test-flux2-windows on ☁️ (eu-central-1)
❯ pwd
Path
----
D:\src\github.com\pellegrino\test-flux2-windows
github.com/pellegrino/test-flux2-windows on ☁️ (eu-central-1)
❯ flux bootstrap github --owner=pellegrino --repository=my-repo --branch=main --path .\clusters\dok8s --personal
► connecting to github.com
✔ repository cloned
✚ generating manifests
✗ generating install manifests failed: Rel: can't make C:\Users\VITORP~1\AppData\Local\Temp\flux-system445357215 relative to D:\src\github.com\pellegrino\test-flux2-windows
My $env:TEMP lives inside the C:. I haven’t tested changing it to a different drive to see if that has any impact.
❯ echo $env:TEMP
C:\Users\VITORP~1\AppData\Local\Temp
To Reproduce
Steps to reproduce the behavior:
- Create a new directory in a drive different than your $env:TEMP. I created mine on D:\
- Use
flux bootstrapto initialize the repo. Flux should fail to install the manifests
Expected behavior
The new directory being bootstrap with the flux manifest files.
Additional context
- Kubernetes version:
- Git provider: github
- Container registry provider:
- OS: Windows 10 with Powershell
flux version
❯ flux --version
flux version 0.10.0
flux check
❯ flux check --pre
► checking prerequisites
✔ kubectl 1.19.7 >=1.18.0-0
✔ Kubernetes 1.20.2 >=1.16.0-0
✔ prerequisites checks passed
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 12
- Comments: 22 (6 by maintainers)
Me to here. Have to copy our repos to disk C.
Please fix. Its been more than two months without any signs of an effort to fix this isssue.
As a workaround I run my terraform commands on WSL. It then uses the linux version of terraform but in most cases that works for me.
I just got that error too. I realized that it happened, when I ran the flux bootstrap from a different drive than drive C … After switching to drive C the execution worked!
I realized that the OP also used different drives, so hopefully this can provide a workaround until this is solved.
I am a proud windows user and hopefully well enough familiar with go - I will try if I can setup a dev env on the weekend, and take a look.
@simongottschlag
I’m not yet fluent in Flux source code, but I suspect the issue leaks from here https://github.com/fluxcd/flux2/blob/5eb43e45664498ef7abde14a942f3771cc987049/pkg/manifestgen/kustomization/kustomization.go#L174-L182 and/or here https://github.com/fluxcd/flux2/blob/5eb43e45664498ef7abde14a942f3771cc987049/pkg/manifestgen/kustomization/kustomization.go#L107 but, I guess, the latter is directly related to the former.
All that seems related to the Kustomize bug https://github.com/kubernetes-sigs/kustomize/issues/2789 from 2020 which was due to bug in its dependency
go-getter.Good news is that in 2021 Kustomize dropped use of go-getter https://github.com/kubernetes-sigs/kustomize/pull/3586 So, perhaps the whole workaround in line
kustomization.go:177above with turning absolute paths to relative paths is no longer needed and once removed, this bug in hand will no longer occur.can't make C:\Users\... relative to D:\src\github.com\...You don’t really need to move the source code the the C:/ Just use CD to change the current folder where you execute the fux cli
I confirm the problem still exists in Flux 0.41.2
I’m simply learning Flux and trying the podinfo deployment as tutorial in Git Bash session:
In case other confused Flux newbies arrive here, switching to WSL session works around the problem easily, without moving files away from
F:or re-installing Flux, just go inside/mnt/f/tmpand re-run the command above. Thanks @bravecobra