Commit 7ce5c792 authored by Sushil Kumar's avatar Sushil Kumar

Adds charts in "charts\" directory to dependencies

Dependencies should be processed even if they are not added to requirements.yaml
Fixes https://github.com/kubernetes/helm/issues/2599
parent 012cb0ac
......@@ -258,6 +258,24 @@ func ProcessRequirementsEnabled(c *chart.Chart, v *chart.Config) error {
}
var chartDependencies []*chart.Chart
// If any dependency is not a part of requirements.yaml
// then this should be added to chartDependencies.
// However, if the dependency is already specified in requirements.yaml
// we should not add it, as it would be anyways processed from requirements.yaml
for _, existingDependency := range c.Dependencies {
var dependencyFound bool
for _, req := range reqs.Dependencies {
if existingDependency.Metadata.Name == req.Name && existingDependency.Metadata.Version == req.Version {
dependencyFound = true
break
}
}
if !dependencyFound {
chartDependencies = append(chartDependencies, existingDependency)
}
}
for _, req := range reqs.Dependencies {
if chartDependency := getAliasDependency(c.Dependencies, req); chartDependency != nil {
chartDependencies = append(chartDependencies, chartDependency)
......
......@@ -378,13 +378,6 @@ func TestDependentChartAliases(t *testing.T) {
t.Fatalf("Cannot load requirements for test chart, %v", err)
}
// var expectedDependencyCharts int
// for _, reqmt := range reqmts.Dependencies {
// expectedDependencyCharts++
// if len(reqmt.Alias) >= 0 {
// expectedDependencyCharts += len(reqmt.Alias)
// }
// }
if len(c.Dependencies) != len(reqmts.Dependencies) {
t.Fatalf("Expected number of chart dependencies %d, but got %d", len(reqmts.Dependencies), len(c.Dependencies))
}
......
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