Skip to content

Commit

Permalink
update .dockercfg content to config.json
Browse files Browse the repository at this point in the history
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": "...=="
        }
    }
}
  • Loading branch information
juanvallejo committed Oct 18, 2017
1 parent 97e0023 commit 027c8b9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/kubectl/cmd/create_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/kubectl/secret_for_docker_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion pkg/kubectl/secret_for_docker_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 027c8b9

Please sign in to comment.