|
|
|
@ -65,6 +65,8 @@ type Dependency struct {
|
|
|
|
|
// ImportValues holds the mapping of source values to parent key to be imported. Each item can be a
|
|
|
|
|
// string or pair of child/parent sublist items.
|
|
|
|
|
ImportValues []interface{} `json:"import-values"`
|
|
|
|
|
// Alias usable alias to be used for the chart
|
|
|
|
|
Alias []string `json:"alias"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ErrNoRequirementsFile to detect error condition
|
|
|
|
@ -216,6 +218,45 @@ func ProcessRequirementsTags(reqs *Requirements, cvals Values) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func copyChartAsAlias(charts []*chart.Chart, dependentChart, aliasChart string) *chart.Chart {
|
|
|
|
|
var chartFound *chart.Chart
|
|
|
|
|
for _, existingChart := range charts {
|
|
|
|
|
if existingChart == nil {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
if existingChart.Metadata == nil {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
if existingChart.Metadata.Name != dependentChart {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
chartFound = new(chart.Chart)
|
|
|
|
|
chartFound.Metadata = &chart.Metadata{
|
|
|
|
|
Name: aliasChart,
|
|
|
|
|
Home: existingChart.Metadata.Home,
|
|
|
|
|
Sources: existingChart.Metadata.Sources,
|
|
|
|
|
Version: existingChart.Metadata.Version,
|
|
|
|
|
Description: existingChart.Metadata.Description,
|
|
|
|
|
Keywords: existingChart.Metadata.Keywords,
|
|
|
|
|
Maintainers: existingChart.Metadata.Maintainers,
|
|
|
|
|
Engine: existingChart.Metadata.Engine,
|
|
|
|
|
Icon: existingChart.Metadata.Icon,
|
|
|
|
|
ApiVersion: existingChart.Metadata.ApiVersion,
|
|
|
|
|
Condition: existingChart.Metadata.Condition,
|
|
|
|
|
Tags: existingChart.Metadata.Tags,
|
|
|
|
|
AppVersion: existingChart.Metadata.AppVersion,
|
|
|
|
|
Deprecated: existingChart.Metadata.Deprecated,
|
|
|
|
|
TillerVersion: existingChart.Metadata.TillerVersion,
|
|
|
|
|
}
|
|
|
|
|
chartFound.Templates = existingChart.Templates
|
|
|
|
|
chartFound.Dependencies = existingChart.Dependencies
|
|
|
|
|
chartFound.Values = existingChart.Values
|
|
|
|
|
chartFound.Files = existingChart.Files
|
|
|
|
|
}
|
|
|
|
|
return chartFound
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ProcessRequirementsEnabled removes disabled charts from dependencies
|
|
|
|
|
func ProcessRequirementsEnabled(c *chart.Chart, v *chart.Config) error {
|
|
|
|
|
reqs, err := LoadRequirements(c)
|
|
|
|
@ -228,6 +269,21 @@ func ProcessRequirementsEnabled(c *chart.Chart, v *chart.Config) error {
|
|
|
|
|
// no requirements to process
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, req := range reqs.Dependencies {
|
|
|
|
|
for _, alias := range req.Alias {
|
|
|
|
|
aliasDependency := copyChartAsAlias(c.Dependencies, req.Name, alias)
|
|
|
|
|
if aliasDependency == nil {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
c.Dependencies = append(c.Dependencies, aliasDependency)
|
|
|
|
|
origReqName := req.Name
|
|
|
|
|
req.Name = alias
|
|
|
|
|
reqs.Dependencies = append(reqs.Dependencies, req)
|
|
|
|
|
req.Name = origReqName
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// set all to true
|
|
|
|
|
for _, lr := range reqs.Dependencies {
|
|
|
|
|
lr.Enabled = true
|
|
|
|
|