-
-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Kubeconfig loading as per #15 #258
Fix Kubeconfig loading as per #15 #258
Conversation
Kubeconfig flag was not honoured if set. This commit checks the flag, then os.env then the default kueconfig location. Tested by installing a handful of apps (new and old style) with and without kubeconfig flag and os.env All installed ok Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
3bf89fc
to
5e09504
Compare
|
||
if command.Flags().Changed("kubeconfig") { | ||
kubeConfigPath, _ = command.Flags().GetString("kubeconfig") | ||
kubeConfigPath, _ := command.Flags().GetString("kubeconfig") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if this could be moved into the install command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i.e. as a global flag
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> updated code based on alexellis#258 Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> removed additional line Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> updated code based on alexellis#258 Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> removed additional line Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> removed unwanted line Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> updated code based on alexellis#258 Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> removed additional line Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> removed unwanted line Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> removed unwanted code Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> updated code based on alexellis#258 Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> removed additional line Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> removed unwanted line Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> removed unwanted code Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> corrected repo path Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> updated code based on #258 Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> removed additional line Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> removed unwanted line Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> removed unwanted code Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com> corrected repo path Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
fmt.Printf("Using kubeconfig: %s\n", kubeConfigPath) | ||
|
||
os.Setenv("KUBECONFIG", kubeConfigPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If KUBECONFIG
is defined but the --kubeconfig
flag is not set, this appears to overwrite KUBECONFIG
with nothing causing a fallback to $HOME/.kube/config
.
Description
Kubeconfig flag was not honoured if set.
This commit checks the flag, then os.env then the default kueconfig
location.
Tested by installing a handful of apps (new and old style) with and
without kubeconfig flag and os.env
All installed ok
Signed-off-by: Alistair Hey alistair@heyal.co.uk
Motivation and Context
Fixes Fix --kubeconfig flag priority #15
How Has This Been Tested?
installing and building locally with various apps with and without the kubeconfig flag
Types of changes
Checklist:
git commit -s