Skip to content

Commit

Permalink
fixed install/upgrade bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sami Alajrami committed Nov 19, 2017
1 parent 963d008 commit 99e6f95
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions decision_maker.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func installRelease(namespace string, r release) {
releaseName := r.Name
cmd := command{
Cmd: "bash",
Args: []string{"-c", "helm install " + r.Chart + " -n " + releaseName + " --namespace " + namespace + " -f " + r.ValuesFile},
Args: []string{"-c", "helm install " + r.Chart + " -n " + releaseName + " --namespace " + namespace + getValuesFile(r) + " --version " + r.Version},
Description: "installing release [ " + releaseName + " ] in namespace [[ " + namespace + " ]]",
}
outcome.addCommand(cmd)
Expand Down Expand Up @@ -183,7 +183,7 @@ func inspectUpgradeScenario(namespace string, r release) {
func upgradeRelease(r release) {
cmd := command{
Cmd: "bash",
Args: []string{"-c", "helm upgrade " + r.Name + " " + r.Chart + " -f " + r.ValuesFile},
Args: []string{"-c", "helm upgrade " + r.Name + " " + r.Chart + getValuesFile(r) + " --version " + r.Version + " --force"},
Description: "upgrading release [ " + r.Name + " ]",
}

Expand All @@ -208,7 +208,7 @@ func reInstallRelease(namespace string, r release) {

installCmd := command{
Cmd: "bash",
Args: []string{"-c", "helm install " + r.Chart + " -n " + releaseName + " --namespace " + namespace + " -f " + r.ValuesFile},
Args: []string{"-c", "helm install " + r.Chart + " --version " + r.Version + " -n " + releaseName + " --namespace " + namespace + getValuesFile(r)},
Description: "installing release [ " + releaseName + " ] in namespace [[ " + namespace + " ]]",
}
outcome.addCommand(installCmd)
Expand Down Expand Up @@ -236,3 +236,11 @@ func extractChartName(releaseChart string) string {
return strings.TrimSpace(strings.Split(releaseChart, "/")[1])

}

// getValuesFile return partial install/upgrade release command to substitute the -f flag in Helm.
func getValuesFile(r release) string {
if r.ValuesFile != "" {
return " -f " + r.ValuesFile
}
return ""
}

0 comments on commit 99e6f95

Please sign in to comment.