From e72d498f4c223843462650f78907f9bf38171b1a Mon Sep 17 00:00:00 2001 From: Mateusz Kubaczyk Date: Fri, 10 Jan 2020 21:37:24 +0100 Subject: [PATCH] Remove --purge from reInstall func --- internal/app/decision_maker.go | 4 ++-- internal/app/release.go | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/app/decision_maker.go b/internal/app/decision_maker.go index b9586a56..42d3930e 100644 --- a/internal/app/decision_maker.go +++ b/internal/app/decision_maker.go @@ -259,7 +259,7 @@ func (cs *currentState) inspectUpgradeScenario(r *release, p *plan) { p.addDecision("Release [ "+r.Name+" ] will be updated", r.Priority, change) } else if extractChartName(r.Chart) != rs.getChartName() { - r.reInstall(rs, p) + r.reInstall(p) p.addDecision("Release [ "+r.Name+" ] is desired to use a new chart [ "+r.Chart+ " ]. Delete of the current release will be planned and new chart will be installed in namespace [ "+ r.Namespace+" ]", r.Priority, change) @@ -272,7 +272,7 @@ func (cs *currentState) inspectUpgradeScenario(r *release, p *plan) { } } } else { - r.reInstall(rs, p) + r.reInstall(p) p.addDecision("Release [ "+r.Name+" ] is desired to be enabled in a new namespace [ "+r.Namespace+ " ]. Uninstall of the current release from namespace [ "+rs.Namespace+" ] will be performed "+ "and then installation in namespace [ "+r.Namespace+" ] will take place", r.Priority, change) diff --git a/internal/app/release.go b/internal/app/release.go index 0c7b0f37..ece87aa3 100644 --- a/internal/app/release.go +++ b/internal/app/release.go @@ -298,9 +298,8 @@ func (r *release) upgrade(p *plan) { // reInstall purge deletes a release and reinstalls it. // This is used when moving a release to another namespace or when changing the chart used for it. -func (r *release) reInstall(rs helmRelease, p *plan) { - - delCmd := helmCmd(concat([]string{"delete", "--purge", r.Name}, flags.getDryRunFlags()), "Deleting release [ "+r.Name+" ] in namespace [ "+r.Namespace+" ]") +func (r *release) reInstall(p *plan) { + delCmd := helmCmd(concat(r.getHelmArgsFor("uninstall"), flags.getDryRunFlags()), "Deleting release [ "+r.Name+" ] in namespace [ "+r.Namespace+" ]") p.addCommand(delCmd, r.Priority, r) installCmd := helmCmd(r.getHelmArgsFor("install"), "Installing release [ "+r.Name+" ] in namespace [ "+r.Namespace+" ]") @@ -324,7 +323,7 @@ func (r *release) rollback(cs *currentState, p *plan) { p.addDecision("Release [ "+r.Name+" ] was deleted and is desired to be rolled back to "+ "namespace [ "+r.Namespace+" ]", r.Priority, create) } else { - r.reInstall(rs, p) + r.reInstall(p) p.addDecision("Release [ "+r.Name+" ] is deleted BUT from namespace [ "+rs.Namespace+ " ]. Will purge delete it from there and install it in namespace [ "+r.Namespace+" ]", r.Priority, create) p.addDecision("WARNING: rolling back release [ "+r.Name+" ] from [ "+rs.Namespace+" ] to [ "+r.Namespace+