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

Update kubeconfig when creating cluster #802

Closed
barkbay opened this issue Aug 22, 2019 · 4 comments
Closed

Update kubeconfig when creating cluster #802

barkbay opened this issue Aug 22, 2019 · 4 comments
Labels
kind/design Categorizes issue or PR as related to design. kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@barkbay
Copy link
Contributor

barkbay commented Aug 22, 2019

What would you like to be added:

Would be neat that Kind automatically updates the kubeconfig of the user instead of creating a new one that should be imported manually.

Some things to consider:

Patch and merge

One of the tricky part is that we have to patch the kubeconfig as it is provided by kubeadm:

  1. host and port must be fixed in order to be used from an external host
  2. if we want to be able to merge it into a larger kubeconfig we have to rename the AuthInfo to avoid collisions because kubeadm always uses the key kubernetes-admin. For example we can suffix it with the name of the cluster.

How to do that:

Use the official go client

Pros

Cons

  • We want to avoid a direct dependency on client-go, it may make Kind harder to depend on in test harnesses

Copy types.go from go-client into the Kind sources

Seems we only need the Config structure from the client-go project.

Pros

  • No dependency on client-go
  • Config seems stable. De we really care to be not up to date ?

Cons

  • It's code duplication
  • Could be seen as a dependency because the struct may evolve and we may have to keep it in sync

Import kubeconfig as map[string]interface{}

Pros

  • No dependancies

Cons

  • Maybe verbose to implement

Make it the default or add a new option ?

Pros

  • User friendly, the context is automatically updated

Cons

  • How to manage backward compatibility ? Maybe that some existing tools/systems are relying on the current behavior ?

related issues/PR: #113 #512 #520 #517 #790

@barkbay barkbay added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 22, 2019
@BenTheElder
Copy link
Member

Thanks for filing this. cc @aojea @neolit123

An additional note is that currently I believe we have an indirect dependency on client-go by way of kustomize, but that could be resolved possibly.

We should also consider the flags and the UX:

  • what should the entries be named like? how should we accomplish that?
  • should this become the new default?
  • how should this feature be toggled?
  • what if you lose your kubeconfig file?

@BenTheElder BenTheElder added priority/backlog Higher priority than priority/awaiting-more-evidence. kind/design Categorizes issue or PR as related to design. labels Aug 26, 2019
@BenTheElder
Copy link
Member

I put some more thought into this and looked around at all the feedback and usage I can find and I think perhaps we should both do this and make it the default mode.

More details in #850 which cross references this and a few other issues.

@BenTheElder
Copy link
Member

I've mostly implemented this under #850, will PR once some fun cases are handled.

The initial implementation was pretty small and simple, but we need a bit more code to handle with KUBECONFIG is multiple files.

@BenTheElder
Copy link
Member

I'm going to fold this into #850 which has more specific details on how to update the UX around kubeconfig.

Also: going the not-client-go route. We recently stopped needing it as a dependency in the command line, and with dropping everything the binary got much smaller and library management got much easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/design Categorizes issue or PR as related to design. kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

2 participants