Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7cfe20db1f | ||
|
|
7fc8212451 | ||
|
|
7cb7ecec90 | ||
|
|
55017eed0f | ||
|
|
b6ba856c31 | ||
|
|
8c6c6fbfa5 | ||
|
|
e071d23fef | ||
|
|
c8b4ad4c46 | ||
|
|
971e3f17cb | ||
|
|
ee3dc9ff0e | ||
|
|
7ecfe70e3e | ||
|
|
d5bd083bf5 | ||
|
|
8d8bcf78a7 | ||
|
|
222261d931 | ||
|
|
e694d93445 | ||
|
|
eaac6dd643 | ||
|
|
c569059b87 | ||
|
|
45428a2e25 | ||
|
|
7b816ea257 | ||
|
|
3c44be059e | ||
|
|
11ffdc7210 | ||
|
|
b4a13d9971 | ||
|
|
4330728215 | ||
|
|
3ae13d4b3c | ||
|
|
17724e7015 | ||
|
|
04a2c48ece | ||
|
|
997a33fc0d | ||
|
|
280c8577a4 | ||
|
|
51058470e5 |
11
.github/ISSUE_TEMPLATE/documentation.md
vendored
Normal file
11
.github/ISSUE_TEMPLATE/documentation.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
name: Documentation
|
||||||
|
about: Docs you'd like to see, or questions about existing docs
|
||||||
|
title: ''
|
||||||
|
labels: documentation
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**What needs explanation:**
|
||||||
|
<!-- e.g. "what happens when ____", "how do I ___", etc. -->
|
||||||
6
.github/pull_request_template.md
vendored
6
.github/pull_request_template.md
vendored
@@ -3,6 +3,8 @@
|
|||||||
Pre-merge checklist:
|
Pre-merge checklist:
|
||||||
|
|
||||||
* [ ] Code changes have tests
|
* [ ] Code changes have tests
|
||||||
* [ ] Any changes to the config are documented in `docs/parameter_reference.md`
|
* [ ] Any config changes are documented:
|
||||||
* [ ] Any new _required_ config is documented in `README.md`
|
* If the change touches _required_ config, there's a corresponding update to `README.md`
|
||||||
|
* There's a corresponding update to `docs/parameter_reference.md`
|
||||||
|
* There's a pull request to update [the parameter reference in drone-plugin-index](https://github.com/drone/drone-plugin-index/blob/master/content/pelotech/drone-helm3/index.md)
|
||||||
* [ ] Any large changes have been verified by running a Drone job
|
* [ ] Any large changes have been verified by running a Drone job
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ drone-helm3 is largely backwards-compatible with drone-helm. There are some know
|
|||||||
* You'll need to migrate the deployments in the cluster [helm-v2-to-helm-v3](https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/).
|
* You'll need to migrate the deployments in the cluster [helm-v2-to-helm-v3](https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/).
|
||||||
* EKS is not supported. See [#5](https://github.com/pelotech/drone-helm3/issues/5) for more information.
|
* EKS is not supported. See [#5](https://github.com/pelotech/drone-helm3/issues/5) for more information.
|
||||||
* The `prefix` setting is no longer supported. If you were relying on the `prefix` setting with `secrets: [...]`, you'll need to switch to the `from_secret` syntax.
|
* The `prefix` setting is no longer supported. If you were relying on the `prefix` setting with `secrets: [...]`, you'll need to switch to the `from_secret` syntax.
|
||||||
|
* During uninstallations, the release history is purged by default. Use `keep_history: true` to return to the old behavior.
|
||||||
* Several settings no longer have any effect. The plugin will produce warnings if any of these are present:
|
* Several settings no longer have any effect. The plugin will produce warnings if any of these are present:
|
||||||
* `purge` -- this is the default behavior in Helm 3
|
* `purge` -- this is the default behavior in Helm 3
|
||||||
* `recreate_pods`
|
* `recreate_pods`
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
_ "github.com/joho/godotenv/autoload"
|
||||||
"github.com/pelotech/drone-helm3/internal/helm"
|
"github.com/pelotech/drone-helm3/internal/helm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ Linting is only triggered when the `helm_command` setting is "lint".
|
|||||||
| values | list\<string\> | | Chart values to use as the `--set` argument to `helm lint`. |
|
| values | list\<string\> | | Chart values to use as the `--set` argument to `helm lint`. |
|
||||||
| string_values | list\<string\> | | Chart values to use as the `--set-string` argument to `helm lint`. |
|
| string_values | list\<string\> | | Chart values to use as the `--set-string` argument to `helm lint`. |
|
||||||
| values_files | list\<string\> | | Values to use as `--values` arguments to `helm lint`. |
|
| values_files | list\<string\> | | Values to use as `--values` arguments to `helm lint`. |
|
||||||
|
| lint_strictly | boolean | | Pass `--strict` to `helm lint`, to turn warnings into errors. |
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -37,6 +38,8 @@ 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. |
|
| 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. |
|
| 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`. |
|
||||||
|
| 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`. |
|
||||||
@@ -54,6 +57,7 @@ Uninstallations are triggered when the `helm_command` setting is "uninstall" or
|
|||||||
| kubernetes_token | string | yes | Token for authenticating to Kubernetes. |
|
| kubernetes_token | string | yes | Token for authenticating to Kubernetes. |
|
||||||
| service_account | string | | Service account for authenticating to Kubernetes. Default is `helm`. |
|
| service_account | string | | Service account for authenticating to Kubernetes. Default is `helm`. |
|
||||||
| kubernetes_certificate | string | | Base64 encoded TLS certificate used by the Kubernetes cluster's certificate authority. |
|
| kubernetes_certificate | string | | Base64 encoded TLS certificate used by the Kubernetes cluster's certificate authority. |
|
||||||
|
| keep_history | boolean | | Pass `--keep-history` to `helm uninstall`, to retain the release history. |
|
||||||
| dry_run | boolean | | Pass `--dry-run` to `helm uninstall`. |
|
| dry_run | boolean | | Pass `--dry-run` to `helm uninstall`. |
|
||||||
| timeout | duration | | Timeout for any *individual* Kubernetes operation. The uninstallation's full runtime may exceed this duration. |
|
| timeout | duration | | Timeout for any *individual* Kubernetes operation. The uninstallation's full runtime may exceed this duration. |
|
||||||
| skip_tls_verify | boolean | | Connect to the Kubernetes cluster without checking for a valid TLS certificate. Not recommended in production. |
|
| skip_tls_verify | boolean | | Connect to the Kubernetes cluster without checking for a valid TLS certificate. Not recommended in production. |
|
||||||
@@ -61,7 +65,9 @@ Uninstallations are triggered when the `helm_command` setting is "uninstall" or
|
|||||||
|
|
||||||
### Where to put settings
|
### Where to put settings
|
||||||
|
|
||||||
Any setting can go in either the `settings` or `environment` section.
|
Any setting can go in either the `settings` or `environment` section. If a setting exists in _both_ sections, the version in `environment` will override the version in `settings`.
|
||||||
|
|
||||||
|
We recommend putting all drone-helm3 configuration in the `settings` block and limiting the `environment` block to variables that are used when building your charts.
|
||||||
|
|
||||||
### Formatting non-string values
|
### Formatting non-string values
|
||||||
|
|
||||||
|
|||||||
1
go.mod
1
go.mod
@@ -4,6 +4,7 @@ go 1.13
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/golang/mock v1.3.1
|
github.com/golang/mock v1.3.1
|
||||||
|
github.com/joho/godotenv v1.3.0 // indirect
|
||||||
github.com/kelseyhightower/envconfig v1.4.0
|
github.com/kelseyhightower/envconfig v1.4.0
|
||||||
github.com/stretchr/testify v1.4.0
|
github.com/stretchr/testify v1.4.0
|
||||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect
|
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect
|
||||||
|
|||||||
2
go.sum
2
go.sum
@@ -2,6 +2,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
|
|||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s=
|
github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s=
|
||||||
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
||||||
|
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||||
|
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=
|
github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=
|
||||||
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
|
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
|||||||
@@ -38,10 +38,14 @@ type Config struct {
|
|||||||
DryRun bool `split_words:"true"` // Pass --dry-run to applicable helm commands
|
DryRun bool `split_words:"true"` // Pass --dry-run to applicable helm commands
|
||||||
Wait bool `` // Pass --wait to applicable helm commands
|
Wait bool `` // Pass --wait to applicable helm commands
|
||||||
ReuseValues bool `split_words:"true"` // Pass --reuse-values to `helm upgrade`
|
ReuseValues bool `split_words:"true"` // Pass --reuse-values to `helm upgrade`
|
||||||
|
KeepHistory bool `split_words:"true"` // Pass --keep-history to `helm uninstall`
|
||||||
Timeout string `` // Argument to pass to --timeout in applicable helm commands
|
Timeout string `` // Argument to pass to --timeout in applicable helm commands
|
||||||
Chart string `` // Chart argument to use in applicable helm commands
|
Chart string `` // Chart argument to use in applicable helm commands
|
||||||
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`
|
||||||
|
CleanupOnFail bool `envconfig:"CLEANUP_FAILED_UPGRADE"` // Pass --cleanup-on-fail to `helm upgrade`
|
||||||
|
LintStrictly bool `split_words:"true"` // Pass --strict to `helm lint`
|
||||||
|
|
||||||
Stdout io.Writer `ignored:"true"`
|
Stdout io.Writer `ignored:"true"`
|
||||||
Stderr io.Writer `ignored:"true"`
|
Stderr io.Writer `ignored:"true"`
|
||||||
|
|||||||
@@ -30,9 +30,6 @@ func NewPlan(cfg Config) (*Plan, error) {
|
|||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
runCfg: run.Config{
|
runCfg: run.Config{
|
||||||
Debug: cfg.Debug,
|
Debug: cfg.Debug,
|
||||||
Values: cfg.Values,
|
|
||||||
StringValues: cfg.StringValues,
|
|
||||||
ValuesFiles: cfg.ValuesFiles,
|
|
||||||
Namespace: cfg.Namespace,
|
Namespace: cfg.Namespace,
|
||||||
Stdout: cfg.Stdout,
|
Stdout: cfg.Stdout,
|
||||||
Stderr: cfg.Stderr,
|
Stderr: cfg.Stderr,
|
||||||
@@ -106,9 +103,14 @@ var upgrade = func(cfg Config) []Step {
|
|||||||
ChartVersion: cfg.ChartVersion,
|
ChartVersion: cfg.ChartVersion,
|
||||||
DryRun: cfg.DryRun,
|
DryRun: cfg.DryRun,
|
||||||
Wait: cfg.Wait,
|
Wait: cfg.Wait,
|
||||||
|
Values: cfg.Values,
|
||||||
|
StringValues: cfg.StringValues,
|
||||||
|
ValuesFiles: cfg.ValuesFiles,
|
||||||
ReuseValues: cfg.ReuseValues,
|
ReuseValues: cfg.ReuseValues,
|
||||||
Timeout: cfg.Timeout,
|
Timeout: cfg.Timeout,
|
||||||
Force: cfg.Force,
|
Force: cfg.Force,
|
||||||
|
Atomic: cfg.AtomicUpgrade,
|
||||||
|
CleanupOnFail: cfg.CleanupOnFail,
|
||||||
})
|
})
|
||||||
|
|
||||||
return steps
|
return steps
|
||||||
@@ -122,6 +124,7 @@ var uninstall = func(cfg Config) []Step {
|
|||||||
steps = append(steps, &run.Uninstall{
|
steps = append(steps, &run.Uninstall{
|
||||||
Release: cfg.Release,
|
Release: cfg.Release,
|
||||||
DryRun: cfg.DryRun,
|
DryRun: cfg.DryRun,
|
||||||
|
KeepHistory: cfg.KeepHistory,
|
||||||
})
|
})
|
||||||
|
|
||||||
return steps
|
return steps
|
||||||
@@ -134,6 +137,10 @@ var lint = func(cfg Config) []Step {
|
|||||||
}
|
}
|
||||||
steps = append(steps, &run.Lint{
|
steps = append(steps, &run.Lint{
|
||||||
Chart: cfg.Chart,
|
Chart: cfg.Chart,
|
||||||
|
Values: cfg.Values,
|
||||||
|
StringValues: cfg.StringValues,
|
||||||
|
ValuesFiles: cfg.ValuesFiles,
|
||||||
|
Strict: cfg.LintStrictly,
|
||||||
})
|
})
|
||||||
|
|
||||||
return steps
|
return steps
|
||||||
|
|||||||
@@ -35,9 +35,6 @@ func (suite *PlanTestSuite) TestNewPlan() {
|
|||||||
cfg := Config{
|
cfg := Config{
|
||||||
Command: "help",
|
Command: "help",
|
||||||
Debug: false,
|
Debug: false,
|
||||||
Values: "steadfastness,forthrightness",
|
|
||||||
StringValues: "tensile_strength,flexibility",
|
|
||||||
ValuesFiles: []string{"/root/price_inventory.yml"},
|
|
||||||
Namespace: "outer",
|
Namespace: "outer",
|
||||||
Stdout: &stdout,
|
Stdout: &stdout,
|
||||||
Stderr: &stderr,
|
Stderr: &stderr,
|
||||||
@@ -45,9 +42,6 @@ func (suite *PlanTestSuite) TestNewPlan() {
|
|||||||
|
|
||||||
runCfg := run.Config{
|
runCfg := run.Config{
|
||||||
Debug: false,
|
Debug: false,
|
||||||
Values: "steadfastness,forthrightness",
|
|
||||||
StringValues: "tensile_strength,flexibility",
|
|
||||||
ValuesFiles: []string{"/root/price_inventory.yml"},
|
|
||||||
Namespace: "outer",
|
Namespace: "outer",
|
||||||
Stdout: &stdout,
|
Stdout: &stdout,
|
||||||
Stderr: &stderr,
|
Stderr: &stderr,
|
||||||
@@ -139,11 +133,16 @@ func (suite *PlanTestSuite) TestUpgrade() {
|
|||||||
ChartVersion: "seventeen",
|
ChartVersion: "seventeen",
|
||||||
DryRun: true,
|
DryRun: true,
|
||||||
Wait: true,
|
Wait: true,
|
||||||
|
Values: "steadfastness,forthrightness",
|
||||||
|
StringValues: "tensile_strength,flexibility",
|
||||||
|
ValuesFiles: []string{"/root/price_inventory.yml"},
|
||||||
ReuseValues: true,
|
ReuseValues: true,
|
||||||
Timeout: "go sit in the corner",
|
Timeout: "go sit in the corner",
|
||||||
Chart: "billboard_top_100",
|
Chart: "billboard_top_100",
|
||||||
Release: "post_malone_circles",
|
Release: "post_malone_circles",
|
||||||
Force: true,
|
Force: true,
|
||||||
|
AtomicUpgrade: true,
|
||||||
|
CleanupOnFail: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
steps := upgrade(cfg)
|
steps := upgrade(cfg)
|
||||||
@@ -159,9 +158,14 @@ func (suite *PlanTestSuite) TestUpgrade() {
|
|||||||
ChartVersion: cfg.ChartVersion,
|
ChartVersion: cfg.ChartVersion,
|
||||||
DryRun: true,
|
DryRun: true,
|
||||||
Wait: cfg.Wait,
|
Wait: cfg.Wait,
|
||||||
|
Values: "steadfastness,forthrightness",
|
||||||
|
StringValues: "tensile_strength,flexibility",
|
||||||
|
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,
|
||||||
|
CleanupOnFail: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
suite.Equal(expected, upgrade)
|
suite.Equal(expected, upgrade)
|
||||||
@@ -198,6 +202,7 @@ func (suite *PlanTestSuite) TestUninstall() {
|
|||||||
DryRun: true,
|
DryRun: true,
|
||||||
Timeout: "think about what you did",
|
Timeout: "think about what you did",
|
||||||
Release: "jetta_id_love_to_change_the_world",
|
Release: "jetta_id_love_to_change_the_world",
|
||||||
|
KeepHistory: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
steps := uninstall(cfg)
|
steps := uninstall(cfg)
|
||||||
@@ -222,6 +227,7 @@ func (suite *PlanTestSuite) TestUninstall() {
|
|||||||
expected = &run.Uninstall{
|
expected = &run.Uninstall{
|
||||||
Release: "jetta_id_love_to_change_the_world",
|
Release: "jetta_id_love_to_change_the_world",
|
||||||
DryRun: true,
|
DryRun: true,
|
||||||
|
KeepHistory: true,
|
||||||
}
|
}
|
||||||
suite.Equal(expected, actual)
|
suite.Equal(expected, actual)
|
||||||
}
|
}
|
||||||
@@ -300,6 +306,10 @@ func (suite *PlanTestSuite) TestAddRepos() {
|
|||||||
func (suite *PlanTestSuite) TestLint() {
|
func (suite *PlanTestSuite) TestLint() {
|
||||||
cfg := Config{
|
cfg := Config{
|
||||||
Chart: "./flow",
|
Chart: "./flow",
|
||||||
|
Values: "steadfastness,forthrightness",
|
||||||
|
StringValues: "tensile_strength,flexibility",
|
||||||
|
ValuesFiles: []string{"/root/price_inventory.yml"},
|
||||||
|
LintStrictly: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
steps := lint(cfg)
|
steps := lint(cfg)
|
||||||
@@ -307,6 +317,10 @@ func (suite *PlanTestSuite) TestLint() {
|
|||||||
|
|
||||||
want := &run.Lint{
|
want := &run.Lint{
|
||||||
Chart: "./flow",
|
Chart: "./flow",
|
||||||
|
Values: "steadfastness,forthrightness",
|
||||||
|
StringValues: "tensile_strength,flexibility",
|
||||||
|
ValuesFiles: []string{"/root/price_inventory.yml"},
|
||||||
|
Strict: true,
|
||||||
}
|
}
|
||||||
suite.Equal(want, steps[0])
|
suite.Equal(want, steps[0])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ import (
|
|||||||
// Config contains configuration applicable to all helm commands
|
// Config contains configuration applicable to all helm commands
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Debug bool
|
Debug bool
|
||||||
Values string
|
|
||||||
StringValues string
|
|
||||||
ValuesFiles []string
|
|
||||||
Namespace string
|
Namespace string
|
||||||
Stdout io.Writer
|
Stdout io.Writer
|
||||||
Stderr io.Writer
|
Stderr io.Writer
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import (
|
|||||||
// Lint is an execution step that calls `helm lint` when executed.
|
// Lint is an execution step that calls `helm lint` when executed.
|
||||||
type Lint struct {
|
type Lint struct {
|
||||||
Chart string
|
Chart string
|
||||||
|
Values string
|
||||||
|
StringValues string
|
||||||
|
ValuesFiles []string
|
||||||
|
Strict bool
|
||||||
cmd cmd
|
cmd cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,15 +36,18 @@ func (l *Lint) Prepare(cfg Config) error {
|
|||||||
|
|
||||||
args = append(args, "lint")
|
args = append(args, "lint")
|
||||||
|
|
||||||
if cfg.Values != "" {
|
if l.Values != "" {
|
||||||
args = append(args, "--set", cfg.Values)
|
args = append(args, "--set", l.Values)
|
||||||
}
|
}
|
||||||
if cfg.StringValues != "" {
|
if l.StringValues != "" {
|
||||||
args = append(args, "--set-string", cfg.StringValues)
|
args = append(args, "--set-string", l.StringValues)
|
||||||
}
|
}
|
||||||
for _, vFile := range cfg.ValuesFiles {
|
for _, vFile := range l.ValuesFiles {
|
||||||
args = append(args, "--values", vFile)
|
args = append(args, "--values", vFile)
|
||||||
}
|
}
|
||||||
|
if l.Strict {
|
||||||
|
args = append(args, "--strict")
|
||||||
|
}
|
||||||
|
|
||||||
args = append(args, l.Chart)
|
args = append(args, l.Chart)
|
||||||
|
|
||||||
|
|||||||
@@ -80,14 +80,14 @@ func (suite *LintTestSuite) TestPrepareRequiresChart() {
|
|||||||
func (suite *LintTestSuite) TestPrepareWithLintFlags() {
|
func (suite *LintTestSuite) TestPrepareWithLintFlags() {
|
||||||
defer suite.ctrl.Finish()
|
defer suite.ctrl.Finish()
|
||||||
|
|
||||||
cfg := Config{
|
cfg := Config{}
|
||||||
Values: "width=5",
|
|
||||||
StringValues: "version=2.0",
|
|
||||||
ValuesFiles: []string{"/usr/local/underrides", "/usr/local/overrides"},
|
|
||||||
}
|
|
||||||
|
|
||||||
l := Lint{
|
l := Lint{
|
||||||
Chart: "./uk/top_40",
|
Chart: "./uk/top_40",
|
||||||
|
Values: "width=5",
|
||||||
|
StringValues: "version=2.0",
|
||||||
|
ValuesFiles: []string{"/usr/local/underrides", "/usr/local/overrides"},
|
||||||
|
Strict: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
command = func(path string, args ...string) cmd {
|
command = func(path string, args ...string) cmd {
|
||||||
@@ -97,6 +97,7 @@ func (suite *LintTestSuite) TestPrepareWithLintFlags() {
|
|||||||
"--set-string", "version=2.0",
|
"--set-string", "version=2.0",
|
||||||
"--values", "/usr/local/underrides",
|
"--values", "/usr/local/underrides",
|
||||||
"--values", "/usr/local/overrides",
|
"--values", "/usr/local/overrides",
|
||||||
|
"--strict",
|
||||||
"./uk/top_40"}, args)
|
"./uk/top_40"}, args)
|
||||||
|
|
||||||
return suite.mockCmd
|
return suite.mockCmd
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
type Uninstall struct {
|
type Uninstall struct {
|
||||||
Release string
|
Release string
|
||||||
DryRun bool
|
DryRun bool
|
||||||
|
KeepHistory bool
|
||||||
cmd cmd
|
cmd cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,6 +37,9 @@ func (u *Uninstall) Prepare(cfg Config) error {
|
|||||||
if u.DryRun {
|
if u.DryRun {
|
||||||
args = append(args, "--dry-run")
|
args = append(args, "--dry-run")
|
||||||
}
|
}
|
||||||
|
if u.KeepHistory {
|
||||||
|
args = append(args, "--keep-history")
|
||||||
|
}
|
||||||
|
|
||||||
args = append(args, u.Release)
|
args = append(args, u.Release)
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,21 @@ func (suite *UninstallTestSuite) TestPrepareDryRunFlag() {
|
|||||||
suite.Equal(expected, suite.actualArgs)
|
suite.Equal(expected, suite.actualArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (suite *UninstallTestSuite) TestPrepareKeepHistoryFlag() {
|
||||||
|
u := Uninstall{
|
||||||
|
Release: "perturbator_sentient",
|
||||||
|
KeepHistory: true,
|
||||||
|
}
|
||||||
|
cfg := Config{}
|
||||||
|
|
||||||
|
suite.mockCmd.EXPECT().Stdout(gomock.Any()).AnyTimes()
|
||||||
|
suite.mockCmd.EXPECT().Stderr(gomock.Any()).AnyTimes()
|
||||||
|
|
||||||
|
suite.NoError(u.Prepare(cfg))
|
||||||
|
expected := []string{"uninstall", "--keep-history", "perturbator_sentient"}
|
||||||
|
suite.Equal(expected, suite.actualArgs)
|
||||||
|
}
|
||||||
|
|
||||||
func (suite *UninstallTestSuite) TestPrepareNamespaceFlag() {
|
func (suite *UninstallTestSuite) TestPrepareNamespaceFlag() {
|
||||||
u := Uninstall{
|
u := Uninstall{
|
||||||
Release: "carly_simon_run_away_with_me",
|
Release: "carly_simon_run_away_with_me",
|
||||||
|
|||||||
@@ -12,9 +12,14 @@ type Upgrade struct {
|
|||||||
ChartVersion string
|
ChartVersion string
|
||||||
DryRun bool
|
DryRun bool
|
||||||
Wait bool
|
Wait bool
|
||||||
|
Values string
|
||||||
|
StringValues string
|
||||||
|
ValuesFiles []string
|
||||||
ReuseValues bool
|
ReuseValues bool
|
||||||
Timeout string
|
Timeout string
|
||||||
Force bool
|
Force bool
|
||||||
|
Atomic bool
|
||||||
|
CleanupOnFail bool
|
||||||
|
|
||||||
cmd cmd
|
cmd cmd
|
||||||
}
|
}
|
||||||
@@ -62,13 +67,19 @@ func (u *Upgrade) Prepare(cfg Config) error {
|
|||||||
if u.Force {
|
if u.Force {
|
||||||
args = append(args, "--force")
|
args = append(args, "--force")
|
||||||
}
|
}
|
||||||
if cfg.Values != "" {
|
if u.Atomic {
|
||||||
args = append(args, "--set", cfg.Values)
|
args = append(args, "--atomic")
|
||||||
}
|
}
|
||||||
if cfg.StringValues != "" {
|
if u.CleanupOnFail {
|
||||||
args = append(args, "--set-string", cfg.StringValues)
|
args = append(args, "--cleanup-on-fail")
|
||||||
}
|
}
|
||||||
for _, vFile := range cfg.ValuesFiles {
|
if u.Values != "" {
|
||||||
|
args = append(args, "--set", u.Values)
|
||||||
|
}
|
||||||
|
if u.StringValues != "" {
|
||||||
|
args = append(args, "--set-string", u.StringValues)
|
||||||
|
}
|
||||||
|
for _, vFile := range u.ValuesFiles {
|
||||||
args = append(args, "--values", vFile)
|
args = append(args, "--values", vFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,20 +91,21 @@ func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
|
|||||||
u := Upgrade{
|
u := Upgrade{
|
||||||
Chart: "hot_ac",
|
Chart: "hot_ac",
|
||||||
Release: "maroon_5_memories",
|
Release: "maroon_5_memories",
|
||||||
ChartVersion: "radio_edit", //-version
|
ChartVersion: "radio_edit",
|
||||||
DryRun: true, //-run
|
DryRun: true,
|
||||||
Wait: true, //-wait
|
Wait: true,
|
||||||
ReuseValues: true, //-values
|
|
||||||
Timeout: "sit_in_the_corner", //-timeout
|
|
||||||
Force: true, //-force
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg := Config{
|
|
||||||
Values: "age=35",
|
Values: "age=35",
|
||||||
StringValues: "height=5ft10in",
|
StringValues: "height=5ft10in",
|
||||||
ValuesFiles: []string{"/usr/local/stats", "/usr/local/grades"},
|
ValuesFiles: []string{"/usr/local/stats", "/usr/local/grades"},
|
||||||
|
ReuseValues: true,
|
||||||
|
Timeout: "sit_in_the_corner",
|
||||||
|
Force: true,
|
||||||
|
Atomic: true,
|
||||||
|
CleanupOnFail: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg := Config{}
|
||||||
|
|
||||||
command = func(path string, args ...string) cmd {
|
command = func(path string, args ...string) cmd {
|
||||||
suite.Equal(helmBin, path)
|
suite.Equal(helmBin, path)
|
||||||
suite.Equal([]string{"upgrade", "--install",
|
suite.Equal([]string{"upgrade", "--install",
|
||||||
@@ -114,6 +115,8 @@ func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
|
|||||||
"--reuse-values",
|
"--reuse-values",
|
||||||
"--timeout", "sit_in_the_corner",
|
"--timeout", "sit_in_the_corner",
|
||||||
"--force",
|
"--force",
|
||||||
|
"--atomic",
|
||||||
|
"--cleanup-on-fail",
|
||||||
"--set", "age=35",
|
"--set", "age=35",
|
||||||
"--set-string", "height=5ft10in",
|
"--set-string", "height=5ft10in",
|
||||||
"--values", "/usr/local/stats",
|
"--values", "/usr/local/stats",
|
||||||
|
|||||||
Reference in New Issue
Block a user