update .dockercfg content to config.json

update the data format of .dockercfg to match the new docker config.json
format, which encapsulates all registry auth objects in an overall
"auths" object:

{
    "auths": {
        "reg.url": {
            "auth": "...=="
        }
    }
}
This commit is contained in:
juanvallejo 2017-10-13 17:36:54 -04:00
parent 97e002352f
commit 027c8b9ef2
No known key found for this signature in database
GPG Key ID: 7D2C958002D6448D
3 changed files with 5 additions and 2 deletions

View File

@ -169,6 +169,7 @@ func NewCmdCreateSecretDockerRegistry(f cmdutil.Factory, cmdOut io.Writer) *cobr
cmd.Flags().String("docker-email", "", i18n.T("Email for Docker registry"))
cmd.Flags().String("docker-server", "https://index.docker.io/v1/", i18n.T("Server location for Docker registry"))
cmd.Flags().Bool("append-hash", false, "Append a hash of the secret to its name.")
cmdutil.AddInclude3rdPartyFlags(cmd)
return cmd
}

View File

@ -141,7 +141,9 @@ func handleDockercfgContent(username, password, email, server string) ([]byte, e
Email: email,
}
dockerCfg := map[string]credentialprovider.DockerConfigEntry{server: dockercfgAuth}
dockerCfg := credentialprovider.DockerConfigJson{
Auths: map[string]credentialprovider.DockerConfigEntry{server: dockercfgAuth},
}
return json.Marshal(dockerCfg)
}

View File

@ -70,7 +70,7 @@ func TestSecretForDockerRegistryGenerate(t *testing.T) {
},
expected: &api.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "foo-gb4kftc655",
Name: "foo-94759gc65b",
},
Data: map[string][]byte{
api.DockerConfigKey: secretData,