Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Rewrite Docker-Desktop contexts #479

Merged
merged 2 commits into from
Mar 20, 2019

Conversation

simonferquel
Copy link
Contributor

@simonferquel simonferquel commented Mar 13, 2019

Now based on #482
- What I did

With Docker Desktop, contexts that target the local daemon/kubernetes
endpoints need to be rewriten, because they are not usable from within a
container (for swarm on windows, npipe:////./pipe/docker_engine must be
renamed to unix:///var/run/docker.sock, for both mac and windows,
Kubernetes Host https://localhost:* must be renamed to https://:6443)

- How I did it

Introduced a "proxy" context store handling those cases

- How to verify it

Unit-tests included, still need to figure how to e2e test that though.

- Description for the changelog

Docker-Desktop users don't have to create a "cnab" context anymore

.vscode/settings.json Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Mar 13, 2019

Codecov Report

Merging #479 into master will decrease coverage by 0.52%.
The diff coverage is 51.19%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #479      +/-   ##
==========================================
- Coverage   69.36%   68.84%   -0.53%     
==========================================
  Files          50       51       +1     
  Lines        2566     2645      +79     
==========================================
+ Hits         1780     1821      +41     
- Misses        548      584      +36     
- Partials      238      240       +2
Impacted Files Coverage Δ
internal/store/store.go 68.42% <ø> (ø) ⬆️
internal/commands/cnab.go 69.46% <100%> (+0.47%) ⬆️
internal/commands/install.go 63.63% <100%> (ø) ⬆️
internal/commands/dockerdesktop.go 46.75% <46.75%> (ø)
types/parameters/parameters.go 96.82% <0%> (+4.76%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9110103...c0ca8ee. Read the comment docs.

@simonferquel simonferquel force-pushed the docker-desktop-hook branch 4 times, most recently from 44d0128 to 1121210 Compare March 15, 2019 16:25
@simonferquel simonferquel changed the title [WIP] Rewrite Docker-Desktop contexts Rewrite Docker-Desktop contexts Mar 15, 2019
@simonferquel
Copy link
Contributor Author

Removed the [WIP] moniker, but it is still referencing @jcsirot working branch. Not sure if we can merge it then, but it dramatically improve usability with Docker Desktop

Gopkg.toml Outdated
@@ -39,8 +39,12 @@ required = ["github.com/wadey/gocovmerge"]
### Waiting on PR https://github.com/docker/cli/pull/1718 and https://github.com/docker/cli/pull/1690 to land on cli ###
[[override]]
name = "github.com/docker/cli"
source = "https://github.com/chris-crone/cli"
revision="d6bfd7e5592dad85969516c131d33910fa5ebd58"
source = "https://github.com/jcsirot/cli"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be rebased on top of #491

@simonferquel
Copy link
Contributor Author

Just rebased on top of #491

}
hostName := hostURL.Hostname()
switch hostName {
case "localhost", "127.0.0.1":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dumb question but... What about ipv6 ? Shouldn't we also add it ? ::1 AFAIR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe that's a linuxkit only thing, and only available with ipv4

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the kubeconfig file being generated by docker-desktop, I guess they will keep using localhost/127.0.0.1... but I can do it yes

Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
Copy link
Member

@chris-crone chris-crone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@simonferquel simonferquel merged commit 0d32841 into docker:master Mar 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants