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 flag priority #15

Closed
burtonr opened this issue Dec 9, 2019 · 10 comments · Fixed by #258
Closed

Fix --kubeconfig flag priority #15

burtonr opened this issue Dec 9, 2019 · 10 comments · Fixed by #258

Comments

@burtonr
Copy link

burtonr commented Dec 9, 2019

The kubeconfig flag on the app install command does not affect the actual kubernetes command execution. The kubernetes command is executed against the default kubeconfig file, not the one passed in via flags.

Expected Behaviour

Passing the kubeconfig flag on the app install command should use that kubeconfig file when installing the app.

Current Behaviour

The kubeconfig variable is only written out, but not utilized:
https://github.com/alexellis/k3sup/blob/master/pkg/cmd/openfaas_app.go#L42

Possible Solution

Since the kubernetes_exec.go file is also in the cmd package, it's possible for the kubectl and kubectlTask functions to look for changes on the flag to get that passed in value. Much the same as the above pasted code from one of the apps.

Steps to Reproduce (for bugs)

  1. k3sup app install openfaas --kubeconfig any/path/to/file
  2. Output will say something like: "Using kubeconfig {the path from above}"
  3. Run kubectl get pods --all-namespaces --kubeconfig /same/path/above
  4. Observe the app was not installed
  5. Run kubectl get pods --all-namespaces (without the kubeconfig)
  6. See the application was installed on the incorrect cluster

Context

I have several k8s cluster set up in various environments for testing. Swapping the config files, or env var is annoying, and really time consuming if I forget before I run the install command.

Your Environment

  • What OS or type or VM are you using? Where is it hosted?
    Linux/ARM
    Desktop (microk8s), GCP, DigitalOcean, Raspberry Pi 3+
  • Operating System and version (e.g. Linux, Windows, MacOS):
    Linux
@phumberdroz
Copy link

So looking at this issue it carries thru all app installs currently.

I would like to make following changes:

  • use only the current kubectlTask and remove the kubectl function and add tests.
  • change the helm3 function so that it returns the task as well and add tests

/cc @alexellis

@alexellis
Copy link
Owner

use only the current kubectlTask and remove the kubectl function and add tests.

This sounds good, please go ahead and raise the first PR for it.

change the helm3 function so that it returns the task as well and add tests

There is no helm3() function, which do you mean?

@phumberdroz
Copy link

helm3Upgrade

@alexellis
Copy link
Owner

When should we expect a PR @phumberdroz ? 😄

phumberdroz referenced this issue in phumberdroz/k3sup Dec 27, 2019
phumberdroz referenced this issue in phumberdroz/k3sup Dec 27, 2019
@phumberdroz
Copy link

Hopefully today @alexellis :)

@alexellis alexellis changed the title kubeconfig flag is not utilized on app install Fix --kubeconfig flag priority Feb 26, 2020
@alexellis alexellis transferred this issue from alexellis/k3sup Feb 26, 2020
@alexellis
Copy link
Owner

Please could someone suggest a simpler alternative fix?

@Kerwood
Copy link

Kerwood commented Mar 30, 2020

Sooo... Is this going to be fixed or ?

@alexellis
Copy link
Owner

See my comment from a month ago. What specific issue are you running into? Some people don't set their KUBECONFIG variable correctly. If you do that, then you shouldn't need this flag.

@Kerwood
Copy link

Kerwood commented Mar 31, 2020

My KUBECONFIG variable is set to ./kubeconfig but I figured that when setting the --kubeconfig paramenter, one could override which kubeconfig ark would use.

@alexellis
Copy link
Owner

You should never use ./, always use pwd to get the whole absolute path. Otherwise it won't work when you move out of the folder or another app does.

Waterdrips referenced this issue in Waterdrips/arkade Oct 31, 2020
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 referenced this issue in Waterdrips/arkade Oct 31, 2020
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>
alexellis pushed a commit that referenced this issue Oct 31, 2020
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>
VariableExp0rt pushed a commit to VariableExp0rt/arkade that referenced this issue Jan 4, 2024
# This is the 1st commit message:

Update README.md

Signed-off-by: liam.baker <liam.baker@sage.com>

# This is the commit message alexellis#2:

address comments and remove dependency on go-git

Signed-off-by: liam.baker <liam.baker@sage.com>

# This is the commit message alexellis#3:

Fix for regex for downloading Node.js

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>

# This is the commit message alexellis#4:

Bump golang.org/x/crypto from 0.14.0 to 0.15.0

Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.15.0.
- [Commits](golang/crypto@v0.14.0...v0.15.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
# This is the commit message alexellis#5:

Bump golang.org/x/mod from 0.13.0 to 0.14.0

Bumps [golang.org/x/mod](https://github.com/golang/mod) from 0.13.0 to 0.14.0.
- [Commits](golang/mod@v0.13.0...v0.14.0)

---
updated-dependencies:
- dependency-name: golang.org/x/mod
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
# This is the commit message alexellis#6:

Bump github.com/spf13/cobra from 1.7.0 to 1.8.0

Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](spf13/cobra@v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
# This is the commit message alexellis#7:

feat: add kwok to arkade get tools

Signed-off-by: Czékus Máté <mate@picloud.hu>

# This is the commit message alexellis#8:

feat: add kwokctl to arkade get tools

Signed-off-by: Czékus Máté <mate@picloud.hu>

# This is the commit message alexellis#9:

Update system go installation for new format

The endpoint on go.dev now returns additional text after the
version, \ntime.

This change trims off the second half of the output.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>

# This is the commit message alexellis#10:

Bump golang.org/x/crypto from 0.15.0 to 0.16.0

Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.15.0 to 0.16.0.
- [Commits](golang/crypto@v0.15.0...v0.16.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
# This is the commit message alexellis#11:

Bump github.com/google/go-containerregistry from 0.16.1 to 0.17.0

Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.16.1 to 0.17.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](google/go-containerregistry@v0.16.1...v0.17.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
# This is the commit message alexellis#12:

Add rgee/snowmachine for the festive period

Signed-off-by: Richard Gee <richard@technologee.co.uk>

# This is the commit message alexellis#13:

Bump actions/setup-go from 4 to 5

Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](actions/setup-go@v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
# This is the commit message alexellis#14:

Update README.md

Signed-off-by: Alex Ellis <alexellis2@gmail.com>
# This is the commit message alexellis#15:

Export LoadFrom

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
VariableExp0rt pushed a commit to VariableExp0rt/arkade that referenced this issue Jan 4, 2024
# This is the 1st commit message:

Update README.md

Signed-off-by: liam.baker <liam.baker@sage.com>

# This is the commit message alexellis#2:

address comments and remove dependency on go-git

Signed-off-by: liam.baker <liam.baker@sage.com>

# This is the commit message alexellis#3:

Fix for regex for downloading Node.js

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>

# This is the commit message alexellis#4:

Bump golang.org/x/crypto from 0.14.0 to 0.15.0

Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.15.0.
- [Commits](golang/crypto@v0.14.0...v0.15.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
# This is the commit message alexellis#5:

Bump golang.org/x/mod from 0.13.0 to 0.14.0

Bumps [golang.org/x/mod](https://github.com/golang/mod) from 0.13.0 to 0.14.0.
- [Commits](golang/mod@v0.13.0...v0.14.0)

---
updated-dependencies:
- dependency-name: golang.org/x/mod
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
# This is the commit message alexellis#6:

Bump github.com/spf13/cobra from 1.7.0 to 1.8.0

Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](spf13/cobra@v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
# This is the commit message alexellis#7:

feat: add kwok to arkade get tools

Signed-off-by: Czékus Máté <mate@picloud.hu>

# This is the commit message alexellis#8:

feat: add kwokctl to arkade get tools

Signed-off-by: Czékus Máté <mate@picloud.hu>

# This is the commit message alexellis#9:

Update system go installation for new format

The endpoint on go.dev now returns additional text after the
version, \ntime.

This change trims off the second half of the output.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>

# This is the commit message alexellis#10:

Bump golang.org/x/crypto from 0.15.0 to 0.16.0

Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.15.0 to 0.16.0.
- [Commits](golang/crypto@v0.15.0...v0.16.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
# This is the commit message alexellis#11:

Bump github.com/google/go-containerregistry from 0.16.1 to 0.17.0

Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.16.1 to 0.17.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](google/go-containerregistry@v0.16.1...v0.17.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
# This is the commit message alexellis#12:

Add rgee/snowmachine for the festive period

Signed-off-by: Richard Gee <richard@technologee.co.uk>

# This is the commit message alexellis#13:

Bump actions/setup-go from 4 to 5

Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](actions/setup-go@v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
# This is the commit message alexellis#14:

Update README.md

Signed-off-by: Alex Ellis <alexellis2@gmail.com>
# This is the commit message alexellis#15:

Export LoadFrom

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>

# This is the commit message alexellis#16:

Bump go.mod and vendor

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>

# This is the commit message alexellis#17:

Fix issue with version flag for Helm charts

The version was being specified in an invalid way in args
for the helm command via a string with a space. This has been
changed to use a slice.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>

# This is the commit message alexellis#18:

Bump golang.org/x/crypto from 0.16.0 to 0.17.0

Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.16.0 to 0.17.0.
- [Commits](golang/crypto@v0.16.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
# This is the commit message alexellis#19:

Move to Go 1.21 for builds and minimum version

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>

# This is the commit message alexellis#20:

Limit builds for same SHA

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>

# This is the commit message alexellis#21:

Use Go 1.21 for e2e checker

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.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 a pull request may close this issue.

4 participants