From febc04a2e1949301db81a3d6d5a05abcbb67cf68 Mon Sep 17 00:00:00 2001 From: sami-alajrami Date: Fri, 3 Jan 2020 11:58:27 +0100 Subject: [PATCH] deprecate some cmd flags --- docs/cmd_reference.md | 23 ++++++++++------------- internal/app/cli.go | 18 ++++++++---------- internal/app/release.go | 5 +---- internal/app/utils.go | 4 ++-- release-notes.md | 10 +++++----- 5 files changed, 26 insertions(+), 34 deletions(-) diff --git a/docs/cmd_reference.md b/docs/cmd_reference.md index e5fe3d0d..6b5b21a6 100644 --- a/docs/cmd_reference.md +++ b/docs/cmd_reference.md @@ -1,5 +1,5 @@ --- -version: v3.0.0-beta5 +version: v3.0.0-beta6 --- # CMD reference @@ -12,7 +12,10 @@ This lists available CMD options in Helmsman: apply the plan directly. `--debug` - show execution logs. + show the debug execution logs and actual helm/kubectl commands. This can log secrets and should only be used for debugging purposes. + + `--verbose` + show verbose execution logs. `--destroy` delete all deployed releases. @@ -50,8 +53,8 @@ This lists available CMD options in Helmsman: `--no-env-subst` turn off environment substitution globally. - `--no-env-values-subst` - turn off environment substitution in values files only. (default true). + `--subst-env-values` + turn on environment substitution in values files. `--no-fancy` don't display the banner and don't use colors. @@ -59,11 +62,11 @@ This lists available CMD options in Helmsman: `--no-ns` don't create namespaces. - `-no-ssm-subst` + `--no-ssm-subst` turn off SSM parameter substitution globally. - `-no-ssm-values-subst` - turn off SSM parameter substitution in values files only (default true). + `--subst-ssm-values` + turn on SSM parameter substitution in values files. `--ns-override string` override defined namespaces with this one. @@ -74,9 +77,6 @@ This lists available CMD options in Helmsman: `--skip-validation` skip desired state validation. - `--suppress-diff-secrets` - don't show secrets in helm diff output. (default true). - `--target` limit execution to specific app. @@ -87,6 +87,3 @@ This lists available CMD options in Helmsman: run 'helm dep up' for local chart `--v` show the version. - - `--verbose` - show verbose execution logs. diff --git a/internal/app/cli.go b/internal/app/cli.go index ac71a538..ac2ddebf 100644 --- a/internal/app/cli.go +++ b/internal/app/cli.go @@ -53,12 +53,11 @@ type cli struct { skipValidation bool keepUntrackedReleases bool showDiff bool - suppressDiffSecrets bool diffContext int noEnvSubst bool - noEnvValuesSubst bool + substEnvValues bool noSSMSubst bool - noSSMValuesSubst bool + substSSMValues bool updateDeps bool forceUpgrades bool noDefaultRepos bool @@ -88,8 +87,8 @@ func (c *cli) parse() { flag.BoolVar(&c.dryRun, "dry-run", false, "apply the dry-run option for helm commands.") flag.BoolVar(&c.destroy, "destroy", false, "delete all deployed releases.") flag.BoolVar(&c.version, "v", false, "show the version") - flag.BoolVar(&c.debug, "debug", false, "show the execution logs") - flag.BoolVar(&c.verbose, "verbose", false, "show verbose execution logs") + flag.BoolVar(&c.debug, "debug", false, "show the debug execution logs and actual helm/kubectl commands. This can log secrets and should only be used for debugging purposes.") + flag.BoolVar(&c.verbose, "verbose", false, "show verbose execution logs.") flag.BoolVar(&c.noBanner, "no-banner", false, "don't show the banner") flag.BoolVar(&c.noColors, "no-color", false, "don't use colors") flag.BoolVar(&c.noFancy, "no-fancy", false, "don't display the banner and don't use colors") @@ -97,11 +96,10 @@ func (c *cli) parse() { flag.BoolVar(&c.skipValidation, "skip-validation", false, "skip desired state validation") flag.BoolVar(&c.keepUntrackedReleases, "keep-untracked-releases", false, "keep releases that are managed by Helmsman from the used DSFs in the command, and are no longer tracked in your desired state.") flag.BoolVar(&c.showDiff, "show-diff", false, "show helm diff results. Can expose sensitive information.") - flag.BoolVar(&c.suppressDiffSecrets, "suppress-diff-secrets", true, "don't show secrets in helm diff output. (default true).") flag.BoolVar(&c.noEnvSubst, "no-env-subst", false, "turn off environment substitution globally") - flag.BoolVar(&c.noEnvValuesSubst, "no-env-values-subst", true, "turn off environment substitution in values files only. (default true).") + flag.BoolVar(&c.substEnvValues, "subst-env-values", false, "turn on environment substitution in values files.") flag.BoolVar(&c.noSSMSubst, "no-ssm-subst", false, "turn off SSM parameter substitution globally") - flag.BoolVar(&c.noSSMValuesSubst, "no-ssm-values-subst", true, "turn off SSM parameter substitution in values files only") + flag.BoolVar(&c.substSSMValues, "subst-ssm-values", false, "turn on SSM parameter substitution in values files.") flag.BoolVar(&c.updateDeps, "update-deps", false, "run 'helm dep up' for local chart") flag.BoolVar(&c.forceUpgrades, "force-upgrades", false, "use --force when upgrading helm releases. May cause resources to be recreated.") flag.BoolVar(&c.noDefaultRepos, "no-default-repos", false, "don't set default Helm repos from Google for 'stable' and 'incubator'") @@ -174,13 +172,13 @@ func (c *cli) parse() { if !c.noEnvSubst { log.Verbose("Substitution of env variables enabled") - if !c.noEnvValuesSubst { + if c.substEnvValues { log.Verbose("Substitution of env variables in values enabled") } } if !c.noSSMSubst { log.Verbose("Substitution of SSM variables enabled") - if !c.noSSMValuesSubst { + if c.substSSMValues { log.Verbose("Substitution of SSM variables in values enabled") } } diff --git a/internal/app/release.go b/internal/app/release.go index 1d937564..86eff126 100644 --- a/internal/app/release.go +++ b/internal/app/release.go @@ -262,16 +262,13 @@ func (r *release) uninstall(p *plan) { func (r *release) diff() string { colorFlag := "" diffContextFlag := []string{} - suppressDiffSecretsFlag := "" + suppressDiffSecretsFlag := "--suppress-secrets" if flags.noColors { colorFlag = "--no-color" } if flags.diffContext != -1 { diffContextFlag = []string{"--context", strconv.Itoa(flags.diffContext)} } - if flags.suppressDiffSecrets { - suppressDiffSecretsFlag = "--suppress-secrets" - } cmd := helmCmd(concat([]string{"diff", colorFlag, suppressDiffSecretsFlag}, diffContextFlag, r.getHelmArgsFor("upgrade")), "Diffing release [ "+r.Name+" ] in namespace [ "+r.Namespace+" ]") diff --git a/internal/app/utils.go b/internal/app/utils.go index 0b24620e..d6d8c595 100644 --- a/internal/app/utils.go +++ b/internal/app/utils.go @@ -168,10 +168,10 @@ func substituteVarsInYaml(file string) string { } yamlFile := string(rawYamlFile) - if !flags.noEnvSubst && !flags.noEnvValuesSubst { + if !flags.noEnvSubst && flags.substEnvValues { yamlFile = substituteEnv(yamlFile) } - if !flags.noSSMSubst && !flags.noSSMValuesSubst { + if !flags.noSSMSubst && flags.substSSMValues { yamlFile = substituteSSM(yamlFile) } diff --git a/release-notes.md b/release-notes.md index 76d71ed8..1b912500 100644 --- a/release-notes.md +++ b/release-notes.md @@ -1,4 +1,4 @@ -# v3.0.0-beta5 +# v3.0.0-beta6 This is a major release to support Helm v3. It is recommended you read the [Helm 3 migration guide](https://helm.sh/docs/topics/v2_v3_migration/) before using this release. @@ -8,12 +8,12 @@ It is recommended you read the [Helm 3 migration guide](https://helm.sh/docs/top The following are the most important changes: - A new and improved logger. - Restructuring the code. -- Parallelized decision making +- Parallelized decision making. - Introducing the `context` stanza to define a context for each DSF. More details [here](docs/misc/merge_desired_state_files). - Deprecating all the DSF stanzas related to Tiller. - Deprecating the `purge` option for releases. - The default value for `storageBackend` is now `secret`. -- The `--suppress-diff-secrets` cmd flag is enabled by default. -- The `--no-env-values-subst` cmd flag is enabled by default. -- The `--no-ssm-values-subst` cmd flag is enabled by default. +- The `--suppress-diff-secrets` is deprecated. Diff secrets are suppressed by default. +- The `--no-env-values-subst` cmd flag is deprecated. Env vars substitution in values files is disabled by default. `--subst-env-values` is introduced to enable it when needed. +- The `--no-ssm-values-subst` cmd flag is deprecated. SSM vars substitution in values files is disabled by default. `--subst-ssm-values` is introduced to enable it when needed.