From e08a9270be1b3be83397c73e7635fd2ecd8f043d Mon Sep 17 00:00:00 2001 From: Allen Bai Date: Mon, 10 Jan 2022 13:42:45 -0500 Subject: [PATCH 1/2] HELM_REGISTRY_CONFIG: change default file of registry config to config.json Changes default registry config file from `registry.json` to `config.json`. This aligns with the `config.json` that is widely used in docker. Closes: https://github.com/helm/helm/issues/10156 Related: https://github.com/helm/helm/issues/10122 Signed-off-by: Allen Bai --- internal/experimental/registry/constants.go | 2 +- pkg/cli/environment.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/experimental/registry/constants.go b/internal/experimental/registry/constants.go index 876e4dc13..9babcdfce 100644 --- a/internal/experimental/registry/constants.go +++ b/internal/experimental/registry/constants.go @@ -21,7 +21,7 @@ const ( OCIScheme = "oci" // CredentialsFileBasename is the filename for auth credentials file - CredentialsFileBasename = "registry.json" + CredentialsFileBasename = "registry/config.json" // ConfigMediaType is the reserved media type for the Helm chart manifest config ConfigMediaType = "application/vnd.cncf.helm.config.v1+json" diff --git a/pkg/cli/environment.go b/pkg/cli/environment.go index 7e3933cc6..d5b208015 100644 --- a/pkg/cli/environment.go +++ b/pkg/cli/environment.go @@ -81,7 +81,7 @@ func New() *EnvSettings { KubeAPIServer: os.Getenv("HELM_KUBEAPISERVER"), KubeCaFile: os.Getenv("HELM_KUBECAFILE"), PluginsDirectory: envOr("HELM_PLUGINS", helmpath.DataPath("plugins")), - RegistryConfig: envOr("HELM_REGISTRY_CONFIG", helmpath.ConfigPath("registry.json")), + RegistryConfig: envOr("HELM_REGISTRY_CONFIG", helmpath.ConfigPath("registry/config.json")), RepositoryConfig: envOr("HELM_REPOSITORY_CONFIG", helmpath.ConfigPath("repositories.yaml")), RepositoryCache: envOr("HELM_REPOSITORY_CACHE", helmpath.CachePath("repository")), } From e3897ad6b10ba2bf02b7505fb2baa63e74039b6f Mon Sep 17 00:00:00 2001 From: Allen Bai Date: Tue, 11 Jan 2022 13:20:56 -0500 Subject: [PATCH 2/2] registry/client: use NewClientWithDockerFallback from oras v1.1.0-rc3 Uses NewClientWithDockerFallback to always use Docker config and modifies go.mod to use oras v1.1.0-rc3. Ref: - https://github.com/helm/helm/pull/10536#issuecomment-1010144075 - https://github.com/oras-project/oras-go/pull/92 Signed-off-by: Allen Bai --- go.mod | 2 +- go.sum | 4 ++-- internal/experimental/registry/client.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 38885ecf8..d328ad8bb 100644 --- a/go.mod +++ b/go.mod @@ -42,6 +42,6 @@ require ( k8s.io/client-go v0.23.1 k8s.io/klog/v2 v2.30.0 k8s.io/kubectl v0.23.1 - oras.land/oras-go v1.1.0-rc2 + oras.land/oras-go v1.1.0-rc3 sigs.k8s.io/yaml v1.3.0 ) diff --git a/go.sum b/go.sum index d2367febf..c56a45885 100644 --- a/go.sum +++ b/go.sum @@ -1746,8 +1746,8 @@ k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/ k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b h1:wxEMGetGMur3J1xuGLQY7GEQYg9bZxKn3tKo5k/eYcs= k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -oras.land/oras-go v1.1.0-rc2 h1:NVMIdNfgRp2TR6oIEmu3w0NTIje2FUav3e7dKjYrrX0= -oras.land/oras-go v1.1.0-rc2/go.mod h1:1A7vR/0KknT2UkJVWh+xMi95I/AhK8ZrxrnUSmXN0bQ= +oras.land/oras-go v1.1.0-rc3 h1:+HdHR0Lgm/0jmjF4SqUif8Ky2XNWhrcP4hxGVvtKIUI= +oras.land/oras-go v1.1.0-rc3/go.mod h1:1A7vR/0KknT2UkJVWh+xMi95I/AhK8ZrxrnUSmXN0bQ= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/internal/experimental/registry/client.go b/internal/experimental/registry/client.go index 78116f60f..3bdfac20b 100644 --- a/internal/experimental/registry/client.go +++ b/internal/experimental/registry/client.go @@ -72,7 +72,7 @@ func NewClient(options ...ClientOption) (*Client, error) { client.credentialsFile = helmpath.ConfigPath(CredentialsFileBasename) } if client.authorizer == nil { - authClient, err := dockerauth.NewClient(client.credentialsFile) + authClient, err := dockerauth.NewClientWithDockerFallback(client.credentialsFile) if err != nil { return nil, err }