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": "...==" } } }
parent 97e00235
......@@ -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
}
......
......@@ -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)
}
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment