Skip to content

[deckhouse-cli] Add the ability to use some d8 functions in Windows#402

Open
VaLosev wants to merge 3 commits into
mainfrom
feat/add-support-windows-variables
Open

[deckhouse-cli] Add the ability to use some d8 functions in Windows#402
VaLosev wants to merge 3 commits into
mainfrom
feat/add-support-windows-variables

Conversation

@VaLosev

@VaLosev VaLosev commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Now, when executing some commands via d8 on Windows, we may receive the error:

PS C:\Users\user\Desktop> .\d8.exe status
Error executing command: failed to setup Kubernetes client: failed to setup Kubernetes client: reading kubeconfig file: GetFileAttributesEx /.kube/config: The system cannot find the path specified.

The reason is that some functions calculate the path using the Go function os.ExpandEnv("$HOME/.kube/config"), which substitutes the $HOME environment variable. On Windows, this variable is not set by default. Windows uses %USERPROFILE% (e.g., C:\Users\user). The $HOME variable on Windows returns an empty string -> resulting in the error described above.

To fix this, a separate helper function, defaultKubeconfigPath, was created in the utilk8s package to avoid having to describe the same logic in five files. It will use the official constant from the Kubernetes client library, clientcmd.RecommendedConfigPathEnvVar, to calculate the path in a cross-platform manner.

Signed-off-by: Losev Valery <valery.losev@flant.com>
@VaLosev VaLosev requested a review from Glitchy-Sheep July 13, 2026 11:31
@VaLosev VaLosev self-assigned this Jul 13, 2026
@VaLosev VaLosev requested a review from ldmonster as a code owner July 13, 2026 11:31
VaLosev and others added 2 commits July 13, 2026 17:54
Signed-off-by: Losev Valery <valery.losev@flant.com>
Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants