Skip to content

Commit

Permalink
Make 19.03-dind the default image (#46)
Browse files Browse the repository at this point in the history
* Make 19.03-dind the default image

... This commit forces the entrypoint of all nodes to dockerd instead of
dockerd-entrypoint to disable TLS dcertificate generation as we don't
want it in our case.
It also forces the primary container to serve the api over port :2735

* use correct docker client dependency

* don't enforce an API version, instead negociate

* bump tooling

* satisfy the linter

* Disable funlen

* lint
  • Loading branch information
jlevesy authored Dec 29, 2019
1 parent 5805ffb commit 05259d4
Show file tree
Hide file tree
Showing 34 changed files with 133 additions and 98 deletions.
11 changes: 5 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
install:
working_directory: ~/sind
docker:
- image: circleci/golang:1.12.6
- image: circleci/golang:1.13
steps:
- checkout
- restore_cache:
Expand All @@ -26,8 +26,7 @@ jobs:
name: Install and Setup Go
command: |
sudo rm -rf /usr/local/go
curl -sSfL https://dl.google.com/go/go1.12.6.linux-amd64.tar.gz -o go.tgz
echo "dbcf71a3c1ea53b8d54ef1b48c85a39a6c9a935d01fc8291ff2b92028e59913c *go.tgz" | sha256sum -c -
curl -sSfL https://dl.google.com/go/go1.13.linux-amd64.tar.gz -o go.tgz
sudo tar --overwrite -C /usr/local -xzf go.tgz
rm go.tgz
sudo mkdir -p "/go/{pkg/mod,src,bin}" && sudo chmod -R 777 /go
Expand All @@ -43,7 +42,7 @@ jobs:
unit_test:
docker:
- image: circleci/golang:1.12.6
- image: circleci/golang:1.13
working_directory: ~/sind
steps:
- checkout
Expand All @@ -53,7 +52,7 @@ jobs:
- run:
name: "Install golangci-lint"
command: |
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.17.1
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.21.0
sudo mv ./bin/golangci-lint $GOPATH/bin
rm -rf ./bin
golangci-lint --version
Expand All @@ -63,7 +62,7 @@ jobs:

release:
docker:
- image: circleci/golang:1.12.6
- image: circleci/golang:1.13
working_directory: ~/sind
steps:
- checkout
Expand Down
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ linters:
- scopelint
- gochecknoinits
- gochecknoglobals
- funlen

issues:
exclude-rules:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dry_release: clean
#

.PHONY: test
test: lint unit_test integration_test
test: unit_test integration_test

.PHONY: integration_test
integration_test:
Expand All @@ -38,7 +38,7 @@ unit_test:

.PHONY: lint
lint:
golangci-lint run
golangci-lint run -c .golangci.yml

.PHONY: clean_docker
clean_docker:
Expand Down
3 changes: 2 additions & 1 deletion cmd/example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func main() {
createCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

client, err := docker.NewClientWithOpts(docker.FromEnv, docker.WithVersion("1.39"))
client, err := docker.NewClientWithOpts(docker.FromEnv, docker.WithAPIVersionNegotiation())
if err != nil {
log.Fatalf("unable to create docker client: %v", err)
}
Expand All @@ -38,6 +38,7 @@ func main() {
defer func() {
deleteCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

if err = sind.DeleteCluster(deleteCtx, client, params.ClusterName); err != nil {
log.Fatalf("unable to delete the cluster: %v", err)
}
Expand Down
14 changes: 8 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,35 @@ module github.com/jlevesy/sind
require (
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
github.com/Microsoft/go-winio v0.4.11 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/coreos/etcd v3.3.13+incompatible
github.com/docker/distribution v2.7.0+incompatible // indirect
github.com/docker/docker v0.0.0-20180730083129-b9bb3bae5161
github.com/docker/go-connections v0.4.0
github.com/docker/go-units v0.3.3 // indirect
github.com/fatih/color v1.7.0 // indirect
github.com/gogo/protobuf v1.2.0 // indirect
github.com/golang/protobuf v1.3.1 // indirect
github.com/golang/sync v0.0.0-20181221193216-37e7f081c4d4
github.com/google/go-cmp v0.2.0 // indirect
github.com/gorilla/context v1.1.1 // indirect
github.com/gorilla/mux v1.6.2 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jonboulle/clockwork v0.1.0 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/moby/moby v1.13.1
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/prometheus/client_golang v0.9.4 // indirect
github.com/pkg/errors v0.8.0 // indirect
github.com/sirupsen/logrus v1.3.0 // indirect
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3 // indirect
github.com/stretchr/testify v1.3.0
github.com/ullaakut/disgo v0.3.0
golang.org/x/net v0.0.0-20181220203305-927f97764cc3 // indirect
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c // indirect
google.golang.org/grpc v1.18.0 // indirect
gotest.tools v2.2.0+incompatible // indirect
)

replace github.com/docker/docker => github.com/docker/engine v0.0.0-20190725163905-fa8dd90ceb7b

go 1.13
49 changes: 4 additions & 45 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,20 @@ github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7O
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
github.com/Microsoft/go-winio v0.4.11 h1:zoIOcVf0xPN1tnMVbTtEdI+P8OofVk3NObnwOQ6nK2Q=
github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw=
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/coreos/etcd v3.3.13+incompatible h1:8F3hqu9fGYLBifCmRCJsicFqDx/D68Rt3q1JMazcgBQ=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker/distribution v2.7.0+incompatible h1:neUDAlf3wX6Ml4HdqTrbcOHXtfRN0TFIwt6YFL7N9RU=
github.com/docker/distribution v2.7.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v0.0.0-20180730083129-b9bb3bae5161 h1:m8FHFsXve3Fz66NafT/aoMequ6u/1xRwipVaHr64gMs=
github.com/docker/docker v0.0.0-20180730083129-b9bb3bae5161/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/engine v0.0.0-20190725163905-fa8dd90ceb7b h1:rN+GLmgWe6Yb5E8yfvGmgKfksvla7QyvqFCUKWTD8Qo=
github.com/docker/engine v0.0.0-20190725163905-fa8dd90ceb7b/go.mod h1:3CPr2caMgTHxxIAZgEMd3uLYPDlRvPqCpyeRf6ncPcY=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk=
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI=
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
Expand All @@ -49,23 +36,15 @@ github.com/gorilla/mux v1.6.2 h1:Pgr17XVTNXAk3q/r4CpKzC5xBM/qW1uVLV+IhRZpIIk=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/moby/moby v1.13.1/go.mod h1:fDXVQ6+S340veQPv35CzDahGBmHsiclFwfEygB/TWMc=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI=
Expand All @@ -74,18 +53,6 @@ github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.4 h1:Y8E/JaaPbmFSW2V81Ab/d8yZFYQQGbni1b1jPcG9Y6A=
github.com/prometheus/client_golang v0.9.4/go.mod h1:oCXIBxdI62A4cR6aTRJCgetEjecSIYzOEaeAn4iYEpM=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME=
github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
Expand All @@ -103,19 +70,14 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3 h1:eH6Eip3UpmR+yM/qI9Ijluzb1bNv/cAU/n+6l8tRSis=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190122071731-054c452bb702 h1:Lk4tbZFnlyPgV+sLgTw5yGfzrlOn9kx4vSombi2FFlY=
golang.org/x/sys v0.0.0-20190122071731-054c452bb702/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
Expand All @@ -128,9 +90,6 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/grpc v1.18.0 h1:IZl7mfBGfbhYx2p2rKRtYgDFw6SBz+kclmxYrCksPPA=
google.golang.org/grpc v1.18.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
5 changes: 4 additions & 1 deletion pkg/cli/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ func runCreate(cmd *cobra.Command, args []string) {
defer cancel()

disgo.StartStep("Connecting to the docker daemon")
client, err := docker.NewClientWithOpts(docker.FromEnv, docker.WithVersion("1.39"))

client, err := docker.NewClientWithOpts(internal.DefaultDockerOpts...)
if err != nil {
fail(disgo.FailStepf("Unable to connect to the docker daemon: %v", err))
}

disgo.StartStepf("Checking if a cluster named %q already exists", clusterName)

clusterInfo, err := sind.InspectCluster(ctx, client, clusterName)
if err != nil {
fail(disgo.FailStepf("Unable to check if the cluster already exists: %v", err))
Expand All @@ -63,6 +65,7 @@ func runCreate(cmd *cobra.Command, args []string) {
}

disgo.StartStepf("Creating a new cluster %q with %d managers and %d workers", clusterName, managers, workers)

clusterConfig := sind.ClusterConfiguration{
Managers: managers,
Workers: workers,
Expand Down
4 changes: 3 additions & 1 deletion pkg/cli/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ func runDelete(cmd *cobra.Command, args []string) {

disgo.StartStep("Connecting to the docker daemon")

client, err := docker.NewClientWithOpts(docker.FromEnv, docker.WithVersion("1.39"))
client, err := docker.NewClientWithOpts(internal.DefaultDockerOpts...)
if err != nil {
fail(disgo.FailStepf("Unable to connect to the docker daemon: %v", err))
}

disgo.StartStepf("Checking if a cluster named %q exists", clusterName)

clusterInfo, err := sind.InspectCluster(ctx, client, clusterName)
if err != nil {
fail(disgo.FailStepf("Unable to check if the cluster exists: %v", err))
Expand All @@ -49,6 +50,7 @@ func runDelete(cmd *cobra.Command, args []string) {
}

disgo.StartStepf("Deleting cluster %q", clusterName)

if err = sind.DeleteCluster(ctx, client, clusterName); err != nil {
fail(disgo.FailStepf("Unable to delete the cluster %q: %v", clusterName, err))
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func runEnv(cmd *cobra.Command, args []string) {
ctx, cancel = internal.WithSignal(ctx, syscall.SIGINT, syscall.SIGTERM)
defer cancel()

client, err := docker.NewClientWithOpts(docker.FromEnv, docker.WithVersion("1.39"))
client, err := docker.NewClientWithOpts(internal.DefaultDockerOpts...)
if err != nil {
fmt.Printf("unable to collect to the docker daemon: %v", err)
os.Exit(1)
Expand Down
4 changes: 3 additions & 1 deletion pkg/cli/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ func runInspect(cmd *cobra.Command, args []string) {
defer cancel()

disgo.StartStep("Connecting to the docker daemon")
client, err := docker.NewClientWithOpts(docker.FromEnv, docker.WithVersion("1.39"))

client, err := docker.NewClientWithOpts(internal.DefaultDockerOpts...)
if err != nil {
fail(disgo.FailStepf("Unable to connect to the docker daemon: %v", err))
}

disgo.StartStepf("Checking if a cluster named %q already exists", clusterName)

clusterInfo, err := sind.InspectCluster(ctx, client, clusterName)
if err != nil {
fail(disgo.FailStepf("Unable to check if the cluster already exists: %v", err))
Expand Down
3 changes: 3 additions & 0 deletions pkg/cli/internal/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
func RenderCluster(out io.Writer, cluster sind.ClusterStatus) {
wr := tabwriter.NewWriter(out, 4, 8, 2, '\t', 0)
defer wr.Flush()

fmt.Fprintf(
wr,
"Name: %s\tStatus: %s\tManagers: %s\t Workers: %s\t\n",
Expand All @@ -23,8 +24,10 @@ func RenderCluster(out io.Writer, cluster sind.ClusterStatus) {
style.Important(fmt.Sprintf("%d/%d", cluster.ManagersRunning, cluster.Managers)),
style.Important(fmt.Sprintf("%d/%d", cluster.WorkersRunning, cluster.Workers)),
)

fmt.Fprintf(wr, "ID\tImage\tRole\tStatus\tIPs\t\n")
fmt.Fprintf(wr, "--\t-----\t----\t------\t---\t\n")

for _, node := range cluster.Nodes {
fmt.Fprintf(
wr,
Expand Down
11 changes: 11 additions & 0 deletions pkg/cli/internal/docker.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package internal

import (
docker "github.com/docker/docker/client"
)

// DefaultDockerOpts are the default docker options to use when interacting with the local docker daemon.
var DefaultDockerOpts = []docker.Opt{
docker.FromEnv,
docker.WithAPIVersionNegotiation(),
}
2 changes: 2 additions & 0 deletions pkg/cli/internal/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import (
func RenderClusterList(out io.Writer, clusters []sind.ClusterStatus) {
wr := tabwriter.NewWriter(out, 4, 8, 2, '\t', 0)
defer wr.Flush()

fmt.Fprintf(wr, "\nName\tStatus\tManagers\tWorkers\t\n")
fmt.Fprintf(wr, "----\t------\t--------\t-------\t\n")

for _, cluster := range clusters {
fmt.Fprintf(
wr,
Expand Down
4 changes: 3 additions & 1 deletion pkg/cli/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ func runList(cmd *cobra.Command, args []string) {
defer cancel()

disgo.StartStep("Connecting to the docker daemon")
client, err := docker.NewClientWithOpts(docker.FromEnv, docker.WithVersion("1.39"))

client, err := docker.NewClientWithOpts(internal.DefaultDockerOpts...)
if err != nil {
fail(disgo.FailStepf("Unable to connect to the docker daemon: %v", err))
}

disgo.StartStep("Listing clusters")

clusters, err := sind.ListClusters(ctx, client)
if err != nil {
fail(disgo.FailStepf("Unable to list clusters: %v", err))
Expand Down
Loading

0 comments on commit 05259d4

Please sign in to comment.