DockerCLI/cli/context/kubernetes
Ian Campbell ec7a9ad6e4 Dynamically register kubernetes context store endpoint type.
This removes the need for the core context code to import
`github.com/docker/cli/cli/context/kubernetes` which in turn reduces the
transitive import tree in this file to not pull in all of Kubernetes.

Note that this means that any calling code which is interested in the
kubernetes endpoint must import `github.com/docker/cli/cli/context/kubernetes`
itself somewhere in order to trigger the dynamic registration. In practice
anything which is interested in Kubernetes must import that package (e.g.
`./cli/command/context.list` does for the `EndpointFromContext` function) to do
anything useful, so this restriction is not too onerous.

As a special case a small amount of Kubernetes related logic remains in
`ResolveDefaultContext` to handle error handling when the stack orchestrator
includes Kubernetes. In order to avoid a circular import loop this hardcodes
the kube endpoint name.

Similarly to avoid an import loop the existing `TestDefaultContextInitializer`
cannot continue to unit test for the Kubernetes case, so that aspect of the
test is carved off into a very similar test in the kubernetes context package.

Lastly, note that the kubernetes endpoint is now modifiable via
`WithContextEndpointType`.

Signed-off-by: Ian Campbell <ijc@docker.com>
(cherry picked from commit 520be05c49)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2019-05-24 15:55:50 +02:00
..
testdata Dynamically register kubernetes context store endpoint type. 2019-05-24 15:55:50 +02:00
constants.go Introduce docker context store 2019-01-04 17:06:51 +01:00
endpoint_test.go Cleanup context store interfaces 2019-04-18 15:49:36 +02:00
load.go Dynamically register kubernetes context store endpoint type. 2019-05-24 15:55:50 +02:00
load_test.go Dynamically register kubernetes context store endpoint type. 2019-05-24 15:55:50 +02:00
save.go Fast Context Switch: commands 2019-01-10 22:25:43 +01:00