Pass CleanupOnFail to the Upgrade Step [#65]
I don't love the mismatch between the helm.Config field (CleanupOnFail) and the setting name (cleanup_failed_upgrade). I do think the setting name should contain "upgrade" since it's specific to the upgrade command, but if I make the config field CleanupFailedUpgrade, it becomes the new longest field name, and gofmt creates a bunch of churn. Is that a good enough reason...?
This commit is contained in:
parent
8c6c6fbfa5
commit
b6ba856c31
|
@ -39,6 +39,7 @@ Installations are triggered when the `helm_command` setting is "upgrade." They c
|
||||||
| timeout | duration | | Timeout for any *individual* Kubernetes operation. The installation's full runtime may exceed this duration. |
|
| timeout | duration | | Timeout for any *individual* Kubernetes operation. The installation's full runtime may exceed this duration. |
|
||||||
| force | boolean | | Pass `--force` to `helm upgrade`. |
|
| force | boolean | | Pass `--force` to `helm upgrade`. |
|
||||||
| atomic_upgrade | boolean | | Pass `--atomic` to `helm upgrade`. |
|
| atomic_upgrade | boolean | | Pass `--atomic` to `helm upgrade`. |
|
||||||
|
| cleanup_failed_upgrade | boolean | | Pass `--cleanup-on-fail` to `helm upgrade`. |
|
||||||
| values | list\<string\> | | Chart values to use as the `--set` argument to `helm upgrade`. |
|
| values | list\<string\> | | Chart values to use as the `--set` argument to `helm upgrade`. |
|
||||||
| string_values | list\<string\> | | Chart values to use as the `--set-string` argument to `helm upgrade`. |
|
| string_values | list\<string\> | | Chart values to use as the `--set-string` argument to `helm upgrade`. |
|
||||||
| values_files | list\<string\> | | Values to use as `--values` arguments to `helm upgrade`. |
|
| values_files | list\<string\> | | Values to use as `--values` arguments to `helm upgrade`. |
|
||||||
|
|
|
@ -44,6 +44,7 @@ type Config struct {
|
||||||
Release string `` // Release 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
|
Force bool `` // Pass --force to applicable helm commands
|
||||||
AtomicUpgrade bool `split_words:"true"` // Pass --atomic to `helm upgrade`
|
AtomicUpgrade bool `split_words:"true"` // Pass --atomic to `helm upgrade`
|
||||||
|
CleanupOnFail bool `envconfig:"CLEANUP_FAILED_UPGRADE"` // Pass --cleanup-on-fail to `helm upgrade`
|
||||||
LintStrictly bool `split_words:"true"` // Pass --strict to `helm lint`
|
LintStrictly bool `split_words:"true"` // Pass --strict to `helm lint`
|
||||||
|
|
||||||
Stdout io.Writer `ignored:"true"`
|
Stdout io.Writer `ignored:"true"`
|
||||||
|
|
|
@ -98,18 +98,19 @@ var upgrade = func(cfg Config) []Step {
|
||||||
steps = append(steps, depUpdate(cfg)...)
|
steps = append(steps, depUpdate(cfg)...)
|
||||||
}
|
}
|
||||||
steps = append(steps, &run.Upgrade{
|
steps = append(steps, &run.Upgrade{
|
||||||
Chart: cfg.Chart,
|
Chart: cfg.Chart,
|
||||||
Release: cfg.Release,
|
Release: cfg.Release,
|
||||||
ChartVersion: cfg.ChartVersion,
|
ChartVersion: cfg.ChartVersion,
|
||||||
DryRun: cfg.DryRun,
|
DryRun: cfg.DryRun,
|
||||||
Wait: cfg.Wait,
|
Wait: cfg.Wait,
|
||||||
Values: cfg.Values,
|
Values: cfg.Values,
|
||||||
StringValues: cfg.StringValues,
|
StringValues: cfg.StringValues,
|
||||||
ValuesFiles: cfg.ValuesFiles,
|
ValuesFiles: cfg.ValuesFiles,
|
||||||
ReuseValues: cfg.ReuseValues,
|
ReuseValues: cfg.ReuseValues,
|
||||||
Timeout: cfg.Timeout,
|
Timeout: cfg.Timeout,
|
||||||
Force: cfg.Force,
|
Force: cfg.Force,
|
||||||
Atomic: cfg.AtomicUpgrade,
|
Atomic: cfg.AtomicUpgrade,
|
||||||
|
CleanupOnFail: cfg.CleanupOnFail,
|
||||||
})
|
})
|
||||||
|
|
||||||
return steps
|
return steps
|
||||||
|
|
|
@ -142,6 +142,7 @@ func (suite *PlanTestSuite) TestUpgrade() {
|
||||||
Release: "post_malone_circles",
|
Release: "post_malone_circles",
|
||||||
Force: true,
|
Force: true,
|
||||||
AtomicUpgrade: true,
|
AtomicUpgrade: true,
|
||||||
|
CleanupOnFail: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
steps := upgrade(cfg)
|
steps := upgrade(cfg)
|
||||||
|
@ -152,18 +153,19 @@ func (suite *PlanTestSuite) TestUpgrade() {
|
||||||
upgrade, _ := steps[1].(*run.Upgrade)
|
upgrade, _ := steps[1].(*run.Upgrade)
|
||||||
|
|
||||||
expected := &run.Upgrade{
|
expected := &run.Upgrade{
|
||||||
Chart: cfg.Chart,
|
Chart: cfg.Chart,
|
||||||
Release: cfg.Release,
|
Release: cfg.Release,
|
||||||
ChartVersion: cfg.ChartVersion,
|
ChartVersion: cfg.ChartVersion,
|
||||||
DryRun: true,
|
DryRun: true,
|
||||||
Wait: cfg.Wait,
|
Wait: cfg.Wait,
|
||||||
Values: "steadfastness,forthrightness",
|
Values: "steadfastness,forthrightness",
|
||||||
StringValues: "tensile_strength,flexibility",
|
StringValues: "tensile_strength,flexibility",
|
||||||
ValuesFiles: []string{"/root/price_inventory.yml"},
|
ValuesFiles: []string{"/root/price_inventory.yml"},
|
||||||
ReuseValues: cfg.ReuseValues,
|
ReuseValues: cfg.ReuseValues,
|
||||||
Timeout: cfg.Timeout,
|
Timeout: cfg.Timeout,
|
||||||
Force: cfg.Force,
|
Force: cfg.Force,
|
||||||
Atomic: true,
|
Atomic: true,
|
||||||
|
CleanupOnFail: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
suite.Equal(expected, upgrade)
|
suite.Equal(expected, upgrade)
|
||||||
|
|
Loading…
Reference in a new issue