Added registryClient to resolver

Signed-off-by: Andrew Block <andy.block@gmail.com>
pull/10527/head
Andrew Block 3 years ago committed by Scott Rigby
parent 1fabbabae9
commit 834a11db56
No known key found for this signature in database
GPG Key ID: C7C6FBB5B91C1155

@ -39,15 +39,17 @@ const FeatureGateOCI = gates.Gate("HELM_EXPERIMENTAL_OCI")
// Resolver resolves dependencies from semantic version ranges to a particular version. // Resolver resolves dependencies from semantic version ranges to a particular version.
type Resolver struct { type Resolver struct {
chartpath string chartpath string
cachepath string cachepath string
registryClient *registry.Client
} }
// New creates a new resolver for a given chart and a given helm home. // New creates a new resolver for a given chart, helm home and registry client.
func New(chartpath, cachepath string) *Resolver { func New(chartpath, cachepath string, registryClient *registry.Client) *Resolver {
return &Resolver{ return &Resolver{
chartpath: chartpath, chartpath: chartpath,
cachepath: cachepath, cachepath: cachepath,
registryClient: registryClient,
} }
} }

@ -19,6 +19,7 @@ import (
"runtime" "runtime"
"testing" "testing"
"helm.sh/helm/v3/internal/experimental/registry"
"helm.sh/helm/v3/pkg/chart" "helm.sh/helm/v3/pkg/chart"
) )
@ -139,7 +140,8 @@ func TestResolve(t *testing.T) {
} }
repoNames := map[string]string{"alpine": "kubernetes-charts", "redis": "kubernetes-charts"} repoNames := map[string]string{"alpine": "kubernetes-charts", "redis": "kubernetes-charts"}
r := New("testdata/chartpath", "testdata/repository") registryClient, _ := registry.NewClient()
r := New("testdata/chartpath", "testdata/repository", registryClient)
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
l, err := r.Resolve(tt.req, repoNames) l, err := r.Resolve(tt.req, repoNames)

@ -232,7 +232,7 @@ func (m *Manager) loadChartDir() (*chart.Chart, error) {
// //
// This returns a lock file, which has all of the dependencies normalized to a specific version. // This returns a lock file, which has all of the dependencies normalized to a specific version.
func (m *Manager) resolve(req []*chart.Dependency, repoNames map[string]string) (*chart.Lock, error) { func (m *Manager) resolve(req []*chart.Dependency, repoNames map[string]string) (*chart.Lock, error) {
res := resolver.New(m.ChartPath, m.RepositoryCache) res := resolver.New(m.ChartPath, m.RepositoryCache, m.RegistryClient)
// NOTE: When OCI dependencies specify a semver range in Version, // NOTE: When OCI dependencies specify a semver range in Version,
// (*Resolver).Resolve must somehow get the list of OCI tag versions // (*Resolver).Resolve must somehow get the list of OCI tag versions
// available to check against this constraint. However for backward // available to check against this constraint. However for backward

Loading…
Cancel
Save