134 Commits

Author SHA1 Message Date
iwilltry42
6d771a20fa error exit if no clusters found 2019-10-21 07:35:07 +02:00
Thorsten Klein
1631a7b91a
Merge pull request #129 from ibuildthecloud/init
Launch containers with init (thanks @ibuildthecloud)
2019-10-19 09:21:25 +02:00
Darren Shepherd
b485682448 Launch containers with init
k3s is not a child subreaper so running k3s as PID 1 will result
in zombie processes.  Using `docker run --init` works around this
issue.
2019-10-18 22:10:44 -07:00
Darren Shepherd
645a5163d4 Only ignore get-kubeconfig error when !all
If you are writing a script to launch k3s clusters checking the exit
code of `get-kubeconfig` is an easy way to tell if the kubeconfig is
available for use.
2019-10-18 22:08:09 -07:00
Thorsten Klein
5c00056118
Merge pull request #121 from tw3n/get-kubeconfig-option-all
Enable --all flag of get-kubeconfig (thanks to @tw3n )
2019-10-10 10:49:01 +02:00
Xavier Hurst
836201611b Enable --all for get-kubeconfig 2019-10-09 21:43:51 +02:00
Cedric Kring
33c3f7cbda Use group values instead of keys for lookup 2019-10-09 19:51:24 +02:00
Cedric Kring
9b888c8216 Added support for group based node volume binds + refactoring 2019-10-09 19:35:13 +02:00
Cedric Kring
1e0aac19f6 Replace loop with simple append & spread 2019-10-05 12:30:08 +02:00
Cedric Kring
418c1887fe Allow volume binds to specific nodes with --volume src:dest@node-name 2019-10-05 11:44:45 +02:00
iwilltry42
9aa5af8d5d improve log level usage 2019-10-02 19:06:36 +02:00
Nicolas Lamirault
b5c4204303
Fix: use warningf
Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
2019-10-01 14:42:28 +02:00
Nicolas Lamirault
44d6fef28c
Update: use log level instead of errorf
Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
2019-10-01 10:15:24 +02:00
Nicolas Lamirault
61107ca5bf
Update: use log level
Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
2019-09-28 19:58:05 +02:00
Nicolas Lamirault
3631e65570
Update: replace log with logrus
Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
2019-09-25 22:41:00 +02:00
misakwa
29204d18a5 Address review comment 2019-08-05 21:14:43 -05:00
misakwa
4e52afd578 Add agent-arg and pass through to container 2019-07-30 23:08:40 -05:00
iwilltry42
205a521c81 go mod tidy 2019-07-30 10:36:49 +02:00
wxdao
058bb1d9e4 Use client.WithAPIVersionNegotiation() 2019-07-25 06:42:31 +00:00
wxdao
c1263487a5 Upgrade docker sdk 2019-07-25 03:15:28 +00:00
Thorsten Klein
c5e5adb0e2
Merge pull request #91 from rancher/feature/import-images-helper
[Feature] import images from docker daemon into k3d using a helper container
2019-07-23 19:26:01 +02:00
iwilltry42
96c883a10a cleanup tools container using defer 2019-07-17 09:32:46 +02:00
iwilltry42
081ec611bc --keep flag to not remove the tarball after import 2019-07-11 15:43:49 +02:00
iwilltry42
a4c75c6568 use a tools container 2019-07-10 18:23:47 +02:00
iwilltry42
07e458d6f1 test 2019-07-08 09:59:01 +02:00
iwilltry42
036a8a9fd0 Merge branch 'feature/load-images' of https://github.com/rancher/k3d into feature/load-images 2019-07-08 09:58:33 +02:00
iwilltry42
f670dde640 test 2019-07-08 09:58:26 +02:00
Ubuntu
4bde59702d error should occur when current time is after start+timout 2019-07-04 02:12:40 +00:00
iwilltry42
93fa5630ac create named volume 2019-07-03 16:51:41 +02:00
iwilltry42
cbdeea3bfa create named volume 2019-07-03 16:50:02 +02:00
iwilltry42
deccb0122a enable importing multiple images at once 2019-07-01 12:17:03 +02:00
iwilltry42
ab2c54ca1d add import-image command for importing single image 2019-07-01 11:31:35 +02:00
Andy Zhou
7d42a4ebd1 Ignore docker-machine command line error
It turns out that docker client only pays attention to the following
environment variables:

DOCKER_HOST to set the url to the docker server.
DOCKER_API_VERSION to set the version of the API to reach, leave empty for latest.
DOCKER_CERT_PATH to load the TLS certificates from.
DOCKER_TLS_VERIFY to enable or disable TLS verification, off by default.

A miss configured DOCKER_MACHINE_NAME won't affect docker client, so k3d
should just ignore the error.
2019-06-14 12:51:32 -07:00
Andy Zhou
aa6e142b81 Log more information when the docker-machine command fails
Currently, when the 'docker-machine' command fails, we only logs

   "exit status 1'

Which is not very helpful in root cause analysis.

With this patch, the 'docker-machine' command's stderr output is also
logged.

  # To cause docker-machine command fail
  $ export DOCKER_MACHINE_NAME=xx
  $ k3d create
2019/06/13 16:45:31 Created cluster network with ID 6fc91e0e5e912443e6b847f113a6a0bb85ccd610e5232592296d4b199f0347cf
2019/06/13 16:45:31 Error executing 'docker-machine ip'
2019/06/13 16:45:31 Docker machine "xx" does not exist. Use "docker-machine ls" to list machines. Use "docker-machine create" to add a new one.
exit status 1
2019-06-13 16:47:27 -07:00
Andy Zhou
f037e1b225 Deprecate --timeout, shift shot hand options around
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.
2019-06-06 12:26:26 -07:00
Andy Zhou
fa18c37155 Simplify Dockerm machine ip handling
Based on review comments from @iwilltry42
2019-06-05 09:18:57 -07:00
Andy Zhou
fc6a01d55a Allow --api-port to take host with either name or IP address
To allow some flexibilities in how user specifies the --api-port
argument.  In case the 'host' is an string, We will try to convert
it into an IP address for port mapping. IP address is also allowed.
2019-06-03 17:51:55 -07:00
Andy Zhou
1080c0b157 Fix up kubeconfig.yaml with --api-port host 2019-06-03 17:51:55 -07:00
Andy Zhou
a72945af71 Enhance docekr port mapping for --api-port 2019-06-03 17:51:55 -07:00
Andy Zhou
58849e4a01 Make use of the parseApiPort() function when creating cluster 2019-06-03 17:51:55 -07:00
Andy Zhou
1e6ac3cce8 Enhance ClusterSpec
Pass the apiPort sturct directly via ClusterSpec.
2019-06-03 17:22:23 -07:00
Andy Zhou
f0c1b24e0b Add parseApiPort()
Now that --api-port takes a string argument, add a parser function to
handle error checking for this argument.
2019-06-03 17:21:44 -07:00
Andy Zhou
b97ef230bd Refactor
The APIs of createServer() and createWorker() takes too many arguments.
It is getting harder to maintain.

Use a new struct ClusterSpec to make API simpler. This also reduces
some code duplications.
2019-06-03 17:18:51 -07:00
Andy Zhou
bd58e9b874
Merge pull request #71 from andyz-dev/docker-machine
[Feature] Docker machine
2019-06-01 11:03:42 -07:00
Andy Zhou
f3ec169414 Add docker machine IP to SAN
When running on a docker machine, the default X598 certificate does not
allow access via docker machine's IP. This patch fixes this by adding
"--tls-san <docker machine IP>" to the K3S server argument list.
2019-06-01 10:57:42 -07:00
Andy Zhou
92b5d90216
Merge pull request #72 from andyz-dev/network-name
[Enhancement] Add k3d- prefix to docker network name
2019-05-31 10:39:54 -07:00
iwilltry42
6a46ef9d94 fix prompt from env 2019-05-31 12:00:00 +02:00
Andy Zhou
1f7d234c80 Add k3d- prefix to docker network name
Should make sense since all container names are with the same prefix.
2019-05-31 02:04:07 -07:00
iwilltry42
f220f0121a get prompt from env depdending on selected shell 2019-05-31 10:52:48 +02:00
iwilltry42
93115400fc add shell struct with prompt differentiation 2019-05-31 09:43:45 +02:00