Support dynamic registration of context store endpoint types
This is a yet unused and the default set remains the same, no expected functional change. Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
parent
d5d693aa6e
commit
087c3f7d08
@ -526,10 +526,22 @@ func resolveContextName(opts *cliflags.CommonOptions, config *configfile.ConfigF
|
|||||||
return DefaultContextName, nil
|
return DefaultContextName, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var defaultStoreEndpoints = []store.NamedTypeGetter{
|
||||||
|
store.EndpointTypeGetter(docker.DockerEndpoint, func() interface{} { return &docker.EndpointMeta{} }),
|
||||||
|
store.EndpointTypeGetter(kubecontext.KubernetesEndpoint, func() interface{} { return &kubecontext.EndpointMeta{} }),
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterDefaultStoreEndpoints registers a new named endpoint
|
||||||
|
// metadata type with the default context store config, so that
|
||||||
|
// endpoint will be supported by stores using the config returned by
|
||||||
|
// DefaultContextStoreConfig.
|
||||||
|
func RegisterDefaultStoreEndpoints(ep ...store.NamedTypeGetter) {
|
||||||
|
defaultStoreEndpoints = append(defaultStoreEndpoints, ep...)
|
||||||
|
}
|
||||||
|
|
||||||
func defaultContextStoreConfig() store.Config {
|
func defaultContextStoreConfig() store.Config {
|
||||||
return store.NewConfig(
|
return store.NewConfig(
|
||||||
func() interface{} { return &DockerContext{} },
|
func() interface{} { return &DockerContext{} },
|
||||||
store.EndpointTypeGetter(docker.DockerEndpoint, func() interface{} { return &docker.EndpointMeta{} }),
|
defaultStoreEndpoints...,
|
||||||
store.EndpointTypeGetter(kubecontext.KubernetesEndpoint, func() interface{} { return &kubecontext.EndpointMeta{} }),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user