With the updated cobra depencendy, we're now passing a context
from the cmd to the called functions.
When creating a cluster, one can pass a Duration to the --timeout
flag, which will create a new context with a timeout.
In the two blocking functions, where we're waiting for the master nodes
(initializing master nodes and "normal" master nodes), we're now
checking for the context cancellation as well, which may be caused
by the timeout.
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
When creating clusters with the --auto-restart flag, any running cluster
will remain "running" up on docker daemon restart.
By default, without this flag, a "running" cluster becomes "stopped"
after docker daemon restart.
Clusters stopped with 'k3d stop' command will remain stopped after
docker daemon restart regardless the settings of this flag.
Most k3d arguments are using in "stringSlice" style, allowing the
argument to supplied multiple times. Currently "volume" is an exception
to this style, require multiple arguments to be supplied in a single
argument, separated by comma.
This commit improve the k3d usability by improve the consistency of its
argument style.
Inspired by the docker CLI, --publish take same input as docker CLI and
provides similar functions. For the k3s cluster server node, it behaves
the same as docker cli; it exports the k3d server ports to the host
ports.
Handling for worker nodes will be added in the subsequent patches.
This option can be used mutiple times for exposing more ports.
--add-port is an alias to this option.