mirror of https://github.com/helm/helm.git
Added registryClient to resolver
Signed-off-by: Andrew Block <andy.block@gmail.com>
This commit is contained in:
parent
1fabbabae9
commit
834a11db56
|
|
@ -39,15 +39,17 @@ const FeatureGateOCI = gates.Gate("HELM_EXPERIMENTAL_OCI")
|
|||
|
||||
// Resolver resolves dependencies from semantic version ranges to a particular version.
|
||||
type Resolver struct {
|
||||
chartpath string
|
||||
cachepath string
|
||||
chartpath string
|
||||
cachepath string
|
||||
registryClient *registry.Client
|
||||
}
|
||||
|
||||
// New creates a new resolver for a given chart and a given helm home.
|
||||
func New(chartpath, cachepath string) *Resolver {
|
||||
// New creates a new resolver for a given chart, helm home and registry client.
|
||||
func New(chartpath, cachepath string, registryClient *registry.Client) *Resolver {
|
||||
return &Resolver{
|
||||
chartpath: chartpath,
|
||||
cachepath: cachepath,
|
||||
chartpath: chartpath,
|
||||
cachepath: cachepath,
|
||||
registryClient: registryClient,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import (
|
|||
"runtime"
|
||||
"testing"
|
||||
|
||||
"helm.sh/helm/v3/internal/experimental/registry"
|
||||
"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"}
|
||||
r := New("testdata/chartpath", "testdata/repository")
|
||||
registryClient, _ := registry.NewClient()
|
||||
r := New("testdata/chartpath", "testdata/repository", registryClient)
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
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.
|
||||
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,
|
||||
// (*Resolver).Resolve must somehow get the list of OCI tag versions
|
||||
// available to check against this constraint. However for backward
|
||||
|
|
|
|||
Loading…
Reference in New Issue