This PR adds a store to the CLI, that can be leveraged to persist and retrieve credentials for various API endpoints, as well as context-specific settings (initially, default stack orchestrator, but we could expand that). This comes with the logic to persist and retrieve endpoints configs for both Docker and Kubernetes APIs. Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
22 lines
1.7 KiB
Go
22 lines
1.7 KiB
Go
// Package store provides a generic way to store credentials to connect to virtually any kind of remote system.
|
|
// The term `context` comes from the similar feature in Kubernetes kubectl config files.
|
|
//
|
|
// Conceptually, a context is a set of metadata and TLS data, that can be used to connect to various endpoints
|
|
// of a remote system. TLS data and metadata are stored separately, so that in the future, we will be able to store sensitive
|
|
// information in a more secure way, depending on the os we are running on (e.g.: on Windows we could use the user Certificate Store, on Mac OS the user Keychain...).
|
|
//
|
|
// Current implementation is purely file based with the following structure:
|
|
// ${CONTEXT_ROOT}
|
|
// - meta/
|
|
// - context1/meta.json: contains context medata (key/value pairs) as well as a list of endpoints (themselves containing key/value pair metadata)
|
|
// - contexts/can/also/be/folded/like/this/meta.json: same as context1, but for a context named `contexts/can/also/be/folded/like/this`
|
|
// - tls/
|
|
// - context1/endpoint1/: directory containing TLS data for the endpoint1 in context1
|
|
//
|
|
// The context store itself has absolutely no knowledge about what a docker or a kubernetes endpoint should contain in term of metadata or TLS config.
|
|
// Client code is responsible for generating and parsing endpoint metadata and TLS files.
|
|
// The multi-endpoints approach of this package allows to combine many different endpoints in the same "context" (e.g., the Docker CLI
|
|
// is able for a single context to define both a docker endpoint and a Kubernetes endpoint for the same cluster, and also specify which
|
|
// orchestrator to use by default when deploying a compose stack on this cluster).
|
|
package store
|