Skip to content
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

Merged
merged 1 commit into from
Oct 31, 2020

Conversation

Waterdrips
Copy link
Contributor

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

How Has This Been Tested?

installing and building locally with various apps with and without the kubeconfig flag

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have tested this on arm, or have added code to prevent deployment

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>
@Waterdrips Waterdrips force-pushed the waterdrips-fix-kubecofig branch from 3bf89fc to 5e09504 Compare October 31, 2020 12:10

if command.Flags().Changed("kubeconfig") {
kubeConfigPath, _ = command.Flags().GetString("kubeconfig")
kubeConfigPath, _ := command.Flags().GetString("kubeconfig")
Copy link
Owner

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?

Copy link
Owner

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

@alexellis alexellis merged commit ba7cbad into alexellis:master Oct 31, 2020
nitishkumar71 added a commit to nitishkumar71/arkade that referenced this pull request Oct 31, 2020
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>
nitishkumar71 added a commit to nitishkumar71/arkade that referenced this pull request Oct 31, 2020
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>
nitishkumar71 added a commit to nitishkumar71/arkade that referenced this pull request Nov 1, 2020
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>
nitishkumar71 added a commit to nitishkumar71/arkade that referenced this pull request Nov 10, 2020
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>
alexellis pushed a commit that referenced this pull request Nov 19, 2020
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)

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.

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.

Fix --kubeconfig flag priority
3 participants