Change:
As per We should look for the .dockercfg in three places: ./.dockercfg, ~/.dockercfg, and $rootDir/.dockercfg
I'll tackle this.
Bunch of questions: we also add a flag that overrides the search mechanism suggested in this issue? Perhaps, ? to the user's homedir requires we use os/user [0] . The os/user package and cross-compiling don't play nice [1]. So, if we add to the search path, cross-compiled kubelet binaries will not actually be able to take advantage of it. Is this an issue? is the proper lookup order? I suggest: if provided, , , . walking through the lookups, do we stop at the first file that exists, or the first file that exists and is parsed as a valid ? [0] [1] /cc
I would absolutely love a --dockercfg option, and it would also be helpful if it logged which .dockercfg it ultimately used.
1) Seems like YAGNI to me 2) Is all of os/user broken? We will eventually want actual user support. I'm fine with dropping it for now. 3) I would say $rootDir/.dockercfg, ./.dockercfg (assuming we drop ~) 4) First successful parse sounds good to me. And can we NOT log errors if files don't exist :)
would it make sense to default to the kubelet config directory if provided rather than the working directory of the kubelet process? then no extra flag required.
What ever happened with this idea?
/cc
It never got high enough on my weekend TODO list :( I can keep telling myself that I need to do it, or we can find someone who has a bit more time than me.
I can probably get to this today.
Cool, thank you! , Mike Danese wrote:

Discussion:
"github.com/GoogleCloudPlatform/kubernetes/cmd/kubelet/app" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" <ins> "github.com/GoogleCloudPlatform/kubernetes/pkg/credentialprovider" </ins> _ "github.com/GoogleCloudPlatform/kubernetes/pkg/healthz" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet" "github.com/GoogleCloudPlatform/kubernetes/pkg/master/ports"

glog.Warningf("No API client: %v", err) } <ins> credentialprovider.SetPreferredDockercfgPath(*rootDirectory) </ins> kcfg := standalone.KubeletConfig{ Address:                 address, AllowPrivileged:         *allowPrivileged,

"os" "path/filepath" "strings" <ins> "sync" </ins> "github.com/golang/glog" )

Email    string } <del> const ( dockerConfigFileLocation = ".dockercfg" </del> <ins> var ( preferredPathLock sync.Mutex preferredPath     = "" workingDirPath    = "" homeDirPath       = os.Getenv("HOME") rootDirPath       = "/" configFileName = ".dockercfg" </ins> ) <ins> func SetPreferredDockercfgPath(path string) { preferredPathLock.Lock() defer preferredPathLock.Unlock() preferredPath = path } func GetPreferredDockercfgPath() string { preferredPathLock.Lock() defer preferredPathLock.Unlock() return preferredPath } </ins> func ReadDockerConfigFile() (cfg DockerConfig, err error) { <del> // TODO(mattmoor): This causes the Kubelet to read /.dockercfg, // which is incorrect.  It should come from $HOME/.dockercfg. absDockerConfigFileLocation, err := filepath.Abs(dockerConfigFileLocation) if err != nil { glog.Errorf("while trying to canonicalize %s: %v", dockerConfigFileLocation, err) } glog.V(2).Infof("looking for .dockercfg at %s", absDockerConfigFileLocation) contents, err := ioutil.ReadFile(absDockerConfigFileLocation) if os.IsNotExist(err) { return make(DockerConfig), nil } if err != nil { glog.Errorf("while trying to read %s: %v", absDockerConfigFileLocation, err) return nil, err </del> <ins> dockerConfigFileLocations := []string{GetPreferredDockercfgPath(), workingDirPath, homeDirPath, rootDirPath} for _, configPath := range dockerConfigFileLocations { absDockerConfigFileLocation, err := filepath.Abs(filepath.Join(configPath, configFileName)) if err != nil { glog.Errorf("while trying to canonicalize %s: %v", configPath, err) continue } glog.V(4).Infof("looking for .dockercfg at %s", absDockerConfigFileLocation) contents, err := ioutil.ReadFile(absDockerConfigFileLocation) if os.IsNotExist(err) { continue } if err != nil { glog.V(4).Infof("while trying to read %s: %v", absDockerConfigFileLocation, err) continue } cfg, err := readDockerConfigFileFromBytes(contents) if err == nil { glog.V(4).Infof("found .dockercfg at %s", absDockerConfigFileLocation) return cfg, nil } </ins> } <del> return readDockerConfigFileFromBytes(contents) </del> <ins> return nil, fmt.Errorf("couldn't find valid .dockercfg after checking in %v", dockerConfigFileLocations) </ins> } // HttpError wraps a non-StatusOK error code as an error.

if cfg, err := ReadDockerConfigFile(); err == nil { return cfg } else if !os.IsNotExist(err) { <del> glog.V(1).Infof("Unable to parse Docker config file: %v", err) </del> <ins> glog.V(4).Infof("Unable to parse Docker config file: %v", err) </ins> } return DockerConfig{} }

"github.com/GoogleCloudPlatform/kubernetes/pkg/clientauth" nodeControllerPkg "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider/controller" "github.com/GoogleCloudPlatform/kubernetes/pkg/controller" <ins> "github.com/GoogleCloudPlatform/kubernetes/pkg/credentialprovider" </ins> "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/config" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/dockertools"

kubelet.SetupLogging() kubelet.SetupCapabilities(kcfg.AllowPrivileged) <ins> credentialprovider.SetPreferredDockercfgPath(kcfg.RootDirectory) </ins> cfg := makePodSourceConfig(kcfg) k, err := createAndInitKubelet(kcfg, cfg) if err != nil {