Current SRC definition only picks up main.go, not all golang source code
of the project. Fix so that 'make fmt" and 'make simplify' can work as
expected.
Thanks @zeerorg for the suggestion on possible container volume leak.
With out this fix the k3s container volumes are left in the reclaimable
state. This experiment confirms it:
$ docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 14 0 2.131GB 2.131GB (100%)
Containers 0 0 0B 0B
Local Volumes 0 0 0B 0B
Build Cache 0 0 0B 0B
$ bin/k3d create; sleep 5; bin/k3d delete
$ docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 14 0 2.131GB 2.131GB (100%)
Containers 0 0 0B 0B
Local Volumes 3 0 2.366MB 2.366MB (100%)
Build Cache 0 0 0B 0B
In this case, 2.36MB are left in the reclaimable state. This number can be
larger with a larger cluster.
With this fix, output of "docker system df" does not contain the
claimable volume
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 14 0 2.131GB 2.131GB (100%)
Containers 0 0 0B 0B
Local Volumes 0 0 0B 0B
Build Cache 0 0 0B 0B
This change improve the error message. It also avoids the tricky situation of
potentially destroying an existing clusters when the same name cluster
creation fails. For more details see issue #42.
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.
Before this change, k3d list stopped cluster as "exited", This patch
change it to "stopped".
$ k3d create -n test
$ k3d stop -n test
$ k3d list --all
+------+------------------------------+--------+---------+
| NAME | IMAGE | STATUS | WORKERS |
+------+------------------------------+--------+---------+
| test | docker.io/rancher/k3s:v0.5.0 | exited | 0/0 |
+------+------------------------------+--------+---------+
Before this change, k3d report the server status as the cluster status.
This commit output the server status if the server and all worker
containers status agree. Otherwise, the cluster status is reported as "unhealthy".
$ k3d create --workers 2
$ docker ps -a
d14135f5929c rancher/k3s:v0.5.0 "/bin/k3s agent" 6 seconds ago Up 5 seconds k3d-k3s-default-worker-1
612d71f3ec23 rancher/k3s:v0.5.0 "/bin/k3s agent" 6 seconds ago Up 5 seconds k3d-k3s-default-worker-0
7f201731bf45 rancher/k3s:v0.5.0 "/bin/k3s server --h…" 7 seconds ago Up 6 seconds 0.0.0.0:6443->6443/tcp k3d-k3s-default-server
$ docker stop d14135f5929c
$ bin/k3d list --all
+-------------+------------------------------+-----------+---------+
| NAME | IMAGE | STATUS | WORKERS |
+-------------+------------------------------+-----------+---------+
| k3s-default | docker.io/rancher/k3s:v0.5.0 | unhealthy | 1/2 |
+-------------+------------------------------+-----------+---------+
Before this patch:
$ k3d create
$ k3d stop
$ k3d list
+------+-------+--------+---------+
| NAME | IMAGE | STATUS | WORKERS |
+------+-------+--------+---------+
+------+-------+--------+---------+
This commit omits such empty table.
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.