Commit Graph

15 Commits

Author SHA1 Message Date
Andy Zhou
f70a8b42f7 Add support for the --publish option for create subcommand
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.
2019-05-08 01:45:16 -07:00
iwilltry42
1294b5b3a6 Merge branch 'imporve-error-message' of https://github.com/andyz-dev/k3d into andyz-dev-imporve-error-message 2019-05-03 07:59:25 +02:00
Andy Zhou
2267924578 cli: Improve error message for 'k3d get-kubeconfig'
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
2019-05-02 12:17:36 -07:00
iwilltry42
942e667b24 add some comments 2019-04-29 08:19:01 +02:00
iwilltry42
068172aa1a fix output order for logs 2019-04-23 15:20:06 +02:00
iwilltry42
e9206a74b2 make start/stop functions start/stop workers as well 2019-04-23 11:22:59 +02:00
iwilltry42
9142529c62 get-kubeconfig using docker sdk 2019-04-23 10:51:02 +02:00
iwilltry42
6c072fb6d9 connect workers and server via own docker network 2019-04-18 16:08:15 +02:00
iwilltry42
7d5964c3b9 fix image not being pulled if reader is not being used 2019-04-18 14:42:41 +02:00
iwilltry42
b0b08d2119 bring back env vars, enable booting workers and base list output on docker data instead of dirs 2019-04-16 11:12:05 +02:00
iwilltry42
7eec5b061b use docker sdk wherever possible 2019-04-15 15:48:43 +02:00
iwilltry42
65b5f06bfc add server-arg and env flags 2019-04-11 14:31:46 +02:00
iwilltry42
65c0bf9e5c better errors 2019-04-10 08:38:54 +02:00
iwilltry42
0b35d7c138 get back --all function for all commands 2019-04-09 15:12:38 +02:00
Rishabh Gupta
29fced4ef7 Added version tags, separated command implementaitons, added wait and timeout
Signed-off-by: Rishabh Gupta <r.g.gupta@outlook.com>
2019-04-09 13:47:47 +05:30