From c8b4ad4c46b1fc4628e721ed0e54925bef1131da Mon Sep 17 00:00:00 2001 From: Erin Call Date: Tue, 7 Jan 2020 12:21:55 -0800 Subject: [PATCH] Pass an atomic_upgrade setting to the Upgrade step [#64] --- docs/parameter_reference.md | 1 + internal/helm/config.go | 1 + internal/helm/plan.go | 1 + internal/helm/plan_test.go | 24 +++++++++++++----------- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/docs/parameter_reference.md b/docs/parameter_reference.md index 3ae3d85..81f82cf 100644 --- a/docs/parameter_reference.md +++ b/docs/parameter_reference.md @@ -38,6 +38,7 @@ Installations are triggered when the `helm_command` setting is "upgrade." They c | wait | boolean | | Wait until kubernetes resources are in a ready state before marking the installation successful. | | timeout | duration | | Timeout for any *individual* Kubernetes operation. The installation's full runtime may exceed this duration. | | force | boolean | | Pass `--force` to `helm upgrade`. | +| atomic_upgrade | boolean | | Pass `--atomic` to `helm upgrade`. | | values | list\ | | Chart values to use as the `--set` argument to `helm upgrade`. | | string_values | list\ | | Chart values to use as the `--set-string` argument to `helm upgrade`. | | values_files | list\ | | Values to use as `--values` arguments to `helm upgrade`. | diff --git a/internal/helm/config.go b/internal/helm/config.go index 7aff42f..704e20c 100644 --- a/internal/helm/config.go +++ b/internal/helm/config.go @@ -43,6 +43,7 @@ type Config struct { Chart string `` // Chart argument to use in applicable helm commands Release string `` // Release argument to use in applicable helm commands Force bool `` // Pass --force to applicable helm commands + AtomicUpgrade bool `split_words:"true"` // Pass --atomic to `helm upgrade` LintStrictly bool `split_words:"true"` // Pass --strict to `helm lint` Stdout io.Writer `ignored:"true"` diff --git a/internal/helm/plan.go b/internal/helm/plan.go index 0a3a1f3..e167269 100644 --- a/internal/helm/plan.go +++ b/internal/helm/plan.go @@ -109,6 +109,7 @@ var upgrade = func(cfg Config) []Step { ReuseValues: cfg.ReuseValues, Timeout: cfg.Timeout, Force: cfg.Force, + Atomic: cfg.AtomicUpgrade, }) return steps diff --git a/internal/helm/plan_test.go b/internal/helm/plan_test.go index acefadb..28f2886 100644 --- a/internal/helm/plan_test.go +++ b/internal/helm/plan_test.go @@ -130,17 +130,18 @@ func (suite *PlanTestSuite) TestExecuteAbortsOnError() { func (suite *PlanTestSuite) TestUpgrade() { cfg := Config{ - ChartVersion: "seventeen", - DryRun: true, - Wait: true, - Values: "steadfastness,forthrightness", - StringValues: "tensile_strength,flexibility", - ValuesFiles: []string{"/root/price_inventory.yml"}, - ReuseValues: true, - Timeout: "go sit in the corner", - Chart: "billboard_top_100", - Release: "post_malone_circles", - Force: true, + ChartVersion: "seventeen", + DryRun: true, + Wait: true, + Values: "steadfastness,forthrightness", + StringValues: "tensile_strength,flexibility", + ValuesFiles: []string{"/root/price_inventory.yml"}, + ReuseValues: true, + Timeout: "go sit in the corner", + Chart: "billboard_top_100", + Release: "post_malone_circles", + Force: true, + AtomicUpgrade: true, } steps := upgrade(cfg) @@ -162,6 +163,7 @@ func (suite *PlanTestSuite) TestUpgrade() { ReuseValues: cfg.ReuseValues, Timeout: cfg.Timeout, Force: cfg.Force, + Atomic: true, } suite.Equal(expected, upgrade)