Remove dependency on docker daemon for core credential types

We are removing dependencies on docker types where possible in the core
libraries. credentialprovider is generic to Docker and uses a public API
(the config file format) that must remain stable. Create an equivalent type
and use a type cast (which would error if we ever change the type) in the
dockershim. We already perform a transformation like this for CRI and so
we aren't changing much.
This commit is contained in:
Clayton Coleman
2018-09-07 16:36:14 -04:00
parent a6eb49f0dc
commit 7e398dc31f
5 changed files with 30 additions and 16 deletions

View File

@@ -22,7 +22,6 @@ import (
"sync"
"time"
dockertypes "github.com/docker/docker/api/types"
"github.com/golang/glog"
)
@@ -40,14 +39,12 @@ type DockerConfigProvider interface {
LazyProvide() *DockerConfigEntry
}
func LazyProvide(creds LazyAuthConfiguration) dockertypes.AuthConfig {
func LazyProvide(creds LazyAuthConfiguration) AuthConfig {
if creds.Provider != nil {
entry := *creds.Provider.LazyProvide()
return DockerConfigEntryToLazyAuthConfiguration(entry).AuthConfig
} else {
return creds.AuthConfig
}
return creds.AuthConfig
}
// A DockerConfigProvider that simply reads the .dockercfg file