Make list output center aligne. It is slightly eaier to read.
Before the commit:
$ bin/k3d list --all
+-------------+------------------------------+---------+---------+
| NAME | IMAGE | STATUS | WORKERS |
+-------------+------------------------------+---------+---------+
| k3s-default | docker.io/rancher/k3s:v0.5.0 | running | 2/2 |
+-------------+------------------------------+---------+---------+
After this commit:
$ bin/k3d list --all
+-------------+------------------------------+---------+---------+
| NAME | IMAGE | STATUS | WORKERS |
+-------------+------------------------------+---------+---------+
| k3s-default | docker.io/rancher/k3s:v0.5.0 | running | 2/2 |
+-------------+------------------------------+---------+---------+
In this output, only the last cell shows up differently.
MAke sure the cluster name is a RFC 1123 compliant host name, since the
cluster name is used as base for expanding into a auto generated
host names for k3s nodes.
All ports exposed by --publish will also be exported for all worker
nodes. The host port will be auto indexed based worker id.
For example: with the following command option:
k3d create --publish 80:80 --publish 90:90/udp --workers 1
The exposed ports will be:
host TCP port 80 -> k3s server TCP 80
host TCP port 90 -> k3s server TCP 90
host UDP port 81 -> k3s worker 0 UDP 80
host UDP port 91 -> k3s worker 0 UDP 90
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.
This class holds the parsed results of the --publish options. Its
methods helps the create clones of class, with mutations applied.
Currently, there are two methods: Offset() change the host ports by a
fixed amount. Addport() adds one additional port to the class.
Before this change, command:
$ k3d create -name test
$ k3d get-kubeconfig
Produces the following error message:
panic: runtime error: index out of range
goroutine 1 [running]:
github.com/rancher/k3d/cli.GetKubeConfig(0xc00031a160, 0x0, 0x0)
/Users/azhou/projs/k3d/cli/commands.go:335 +0x105d
github.com/urfave/cli.HandleAction(0x13e7ca0, 0x148f0b0, 0xc00031a160, 0xc000304000, 0x0)
/Users/azhou/projs/rcloud/pkg/mod/github.com/urfave/cli@v1.20.0/app.go:490 +0xc8
github.com/urfave/cli.Command.Run(0x1477cb5, 0xe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1480cd8, 0x23, 0x0, ...)
/Users/azhou/projs/rcloud/pkg/mod/github.com/urfave/cli@v1.20.0/command.go:210 +0x996
github.com/urfave/cli.(*App).Run(0xc0000bc1a0, 0xc00000e060, 0x2, 0x2, 0x0, 0x0)
/Users/azhou/projs/rcloud/pkg/mod/github.com/urfave/cli@v1.20.0/app.go:255 +0x6af
main.main()
/Users/azhou/projs/k3d/main.go:185 +0x11e0
This patch improve the error message by avoid the panic. Now the output
becomes:
019/05/02 12:05:30 No server container for cluster k3s_default
ith a fresh checked out k3d tree without required tools installed, Any make command gives the following error message:
Makefile:71: *** recipe commences before first target. Stop.
Basically, the section around line 71 are not properly formed makefile rules. This error is hidden when required tools
are installed. The error can be re-exposed with the "make extra-clean" command.
The install-tools target is intended to be invoked when installing the development tree for the fist time.
The extra-clean target removes the dependent packages that k3d requires. This makes testing
makefile rules that install those packages easier.
This target helps to expose a bug that the next patch fixes.