Skip to content

Comments

Add KUBECONFIG environment variable validation for windows#12

Draft
jitesh-gupta wants to merge 2 commits intomainfrom
dev/jitgupta/fixSetupWindows
Draft

Add KUBECONFIG environment variable validation for windows#12
jitesh-gupta wants to merge 2 commits intomainfrom
dev/jitgupta/fixSetupWindows

Conversation

@jitesh-gupta
Copy link
Member

Similar to the changes made for linux setup: #11

Small tweak to the KUBECONFIG setup.

  • Issue: Noticed that setup fails if anon.conf is not present in the same directory as the setup file. This is contradictory to exposing an environment variable KUBECONFIG that can be set to a path outside of the repo as well.

  • Fix: Instead of checking for existence of anon.conf in the same directory as the setup script, check if KUBECONFIG is set up correctly.

@jitesh-gupta jitesh-gupta requested a review from saienduri March 17, 2025 16:27
@saienduri
Copy link
Contributor

saienduri commented Mar 17, 2025

I think the goal is for the kubectl part to always work as it is part of the base kubernetes setup. Can we add to the local session but also keep the persistence in your PR? The kubeconfig part is fine for the user to always set, but it'd be nice for the user to not worry about the base kubernetes setup

@jitesh-gupta
Copy link
Member Author

I think the goal is for the kubectl part to always work as it is part of the base kubernetes setup. Can we add to the local session but also keep the persistence in your PR? The kubeconfig part is fine for the user to always set, but it'd be nice for the user to not worry about the base kubernetes setup

Sounds good!

@jitesh-gupta jitesh-gupta requested a review from yamiyysu March 25, 2025 19:34
# Exit early if KUBECONFIG is not set to a valid path
$kubeconfigPath = [System.Environment]::GetEnvironmentVariable('KUBECONFIG')
if ( -not $kubeconfigPath) {
Write-Host "KUBECONFIG is not set or empty. Exiting"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it KUBECONFIG is not set, it'll be default to ~/.kube/config

The assumption here is KUBECONFIG has to be se. Please verify the correctness of this assumption

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the documentation: "If the KUBECONFIG env variable doesn't exist, kubectl uses the default kubeconfig file, $HOME/.kube/config"

Because we are not giving instructions to our customers about the default kubeconfig file and are going with the KUBECONFIG environment variable route, I think we should have this check.

I am also fine with providing more instructions around the kubeconfig settings and removing this check completely.

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.

3 participants