Skip to content
This repository was archived by the owner on Jan 25, 2019. It is now read-only.

Commit b1c573b

Browse files
authored
Merge pull request #37 from shettyh/master
Fix for #35. Handling the requirements file properly
2 parents 562029c + e8e69dd commit b1c573b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

helm-app-operator/pkg/helm/helm.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ func (c installer) InstallRelease(r *v1alpha1.HelmApp) (*v1alpha1.HelmApp, error
7272
Chart: chart,
7373
Values: &cpb.Config{Raw: string(cr)},
7474
}
75+
76+
err := processRequirements(installReq.Chart,installReq.Values)
77+
if err != nil {
78+
return nil, err
79+
}
80+
7581
releaseResponse, err := tiller.InstallRelease(context.TODO(), installReq)
7682
if err != nil {
7783
return r, err
@@ -83,6 +89,12 @@ func (c installer) InstallRelease(r *v1alpha1.HelmApp) (*v1alpha1.HelmApp, error
8389
Chart: chart,
8490
Values: &cpb.Config{Raw: string(cr)},
8591
}
92+
93+
err := processRequirements(updateReq.Chart,updateReq.Values)
94+
if err != nil {
95+
return r, err
96+
}
97+
8698
releaseResponse, err := tiller.UpdateRelease(context.TODO(), updateReq)
8799
if err != nil {
88100
return r, err
@@ -154,3 +166,18 @@ func releaseName(r *v1alpha1.HelmApp) string {
154166
func valuesFromResource(r *v1alpha1.HelmApp) ([]byte, error) {
155167
return yaml.Marshal(r.Spec)
156168
}
169+
170+
// processRequirements will process the requirements file
171+
// It will disable/enable the charts based on condition in requirements file
172+
// Also imports the specified chart values from child to parent.
173+
func processRequirements(chart *cpb.Chart, values *cpb.Config) error {
174+
err := chartutil.ProcessRequirementsEnabled(chart, values)
175+
if err != nil {
176+
return err
177+
}
178+
err = chartutil.ProcessRequirementsImportValues(chart)
179+
if err != nil {
180+
return err
181+
}
182+
return nil
183+
}

0 commit comments

Comments
 (0)