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

kcs uses cluster name and not context name #7

Closed
ulrichSchreiner opened this issue May 19, 2018 · 1 comment · Fixed by #9
Closed

kcs uses cluster name and not context name #7

ulrichSchreiner opened this issue May 19, 2018 · 1 comment · Fixed by #9

Comments

@ulrichSchreiner
Copy link
Contributor

ulrichSchreiner commented May 19, 2018

hi,

when using kcs the code uses the name of the cluster as the context-name:

kcs() {
  context="$(kubectl config get-contexts | _inline_fzf | awk '{print $2}')"
  eval kubectl config set current-context "${context}"
}

$ kubectl config get-contexts
CURRENT   NAME           CLUSTER    AUTHINFO      NAMESPACE
          asterix-ns1    asterix    user1         ns1
*         obelix-ns1     obelix     user2         ns1
          obelix-ns2     obelix     user3         ns2
          minikube       minikube   minikube      

this only works, when the clustername and contextname are identical. if they are different, the configuration is corrupted. i think you should use print $1 for awk:

 context="$(kubectl config get-contexts | _inline_fzf | awk '{print $1}')"
@metalmatze
Copy link
Contributor

Thanks for reporting @ulrichSchreiner. Do you mind creating a PR for this?

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.

2 participants