- package cluster: use context.Context as first function param in every
exported function
- package cmd: pass cmd.Context() to calls to package cluster exported
functions
- refactoring in pkg/cluster/kubeconfig
- new functions to delete a cluster from kubeconfig
- call RemoveClusterFromDefaultKubeConfig after deleting cluster
- enables wait-for-master
- calls GetAndWriteKubeConfig after successful cluster creation to
update the default kubeconfig with the new cluster's details
- does NOT automatically switch the current-context
- outputs a different line saying, that you can switch context now
Before this change, we simply did a search/replace on the
stringified kubeconfig blob.
Now we're parsing it into a kubeconfig struct and modify the fields
directly in a more controlled manner.
Here's what we change:
- server URL: based on the chosen APIHost and APIPort
- cluster name: default -> k3d-CLUSTERNAME
- user name: default -> admin@k3d-CLUSTERNAME
- context name: default -> admin@k3d-CLUSTERNAME
Up to now, we exposed ports on single master nodes, which is quite
inconvenient on user side and troublesome on development side.
Now, we're creating a proxy container which exposes a single port
and proxies traffic to all master nodes.
Currently, this only works with 'k3d create cluster' and won't
update the proxy when using 'k3d create node --role master'.
We have been giving user warnings about --timeout going away for a
while. Now fully deprecate it.
Use -t for --wait option
Move -w from --wait to --workers. Many users of K3d generate multi-node
clusters, -w will make their life easier.
In addition to provide an interactive shell, this patch adds the
'--command' and '-c' options to allow user to issue a command in the
context of a cluster.
For example:
$ k3d bash -c 'kubectl cluster-info'
Add the basic frame work for supporting spawning a bash shell by cli
command.
With this change, we can spawn a bash shell in the context of a cluster
$ k3d create -n my-cluster
$ k3d bash -n my-cluster
[my-cluster] $>
// execute commands with KUBECONFIG already set up
[my-cluster] $> kubectl get pods