kustomize localize generates file names that Windows cannot create
/kind bug
Found while working on #4001.
What happened?
kustomize localize turns parts of remote URLs into local file and directory names. Some of these names are not valid on Windows:
- An IPv6 host becomes a directory name with colons. For example,
https://[2001:4860:4860::8888]/file.yamlis localized under2001:4860:4860::8888/, and Windows does not allow:in file names. - A URL path segment
*becomes a file named*. For example,https://host/*is localized to.../host/*. - A URL path segment
...becomes a directory named.... Windows drops trailing dots from names, so this directory cannot be created.
What did you expect to happen?
Either localize uses names that are valid on every platform (for example, by escaping the characters that Windows rejects), or it fails early with a clear error that names the URL it cannot localize.
How can we reproduce it (as minimally and precisely as possible)?
Run the localizer unit tests on Windows:
cd api
go test ./internal/localizer/ -run 'TestLocFilePathColon|TestLocFilePath_SpecialChar|TestLocFilePath_SpecialFiles|TestLocRootPath_URLComponents'These tests check that the names returned by locFilePath and locRootPath can be created on disk.
Expected output
The tests pass, as they do on Linux and macOS.
Actual output
On a GitHub Actions windows-latest runner:
--- FAIL: TestLocFilePathColon
mkdir ...\TestLocFilePathColon...\001\2001:4860:4860::8888: The filename, directory name, or volume label syntax is incorrect.
--- FAIL: TestLocFilePath_SpecialChar
open ...\TestLocFilePath_SpecialChar...\001\*: The filename, directory name, or volume label syntax is incorrect.
--- FAIL: TestLocFilePath_SpecialFiles/hidden_files
mkdir ...\TestLocFilePath_SpecialFileshidden_files...\001\...: Cannot create a file when that file already exists.
--- FAIL: TestLocRootPath_URLComponents/IPv6
mkdir ...\localized-files\2001:4860:4860::8888: The filename, directory name, or volume label syntax is incorrect.I have not run kustomize localize itself on Windows against URLs like these. These failures come from the unit tests.
Kustomize version
Built from master at 078ab6cf8.
Operating system
Windows (GitHub Actions windows-latest)
Claude Code on behalf of Adriano Machado (@ammachado)
This was generated by an AI agent and may contain inaccuracies. Please verify before relying on it.
Source: kubernetes-sigs/kustomize