Skip to content

Commit

Permalink
Merge pull request #132 from dreamteam-gg/suppress-diff-secrets
Browse files Browse the repository at this point in the history
Adding ability to suppress secrets in helm diff output, UnmarshalStrict for YAML
  • Loading branch information
Sami Alajrami authored Nov 26, 2018
2 parents dc340f9 + 42ede1c commit 2795d3b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion decision_maker.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,17 @@ func diffRelease(r *release) string {
exitCode := 0
msg := ""
colorFlag := ""
suppressDiffSecretsFlag := ""
if noColors {
colorFlag = "--no-color "
}
if suppressDiffSecrets {
suppressDiffSecretsFlag = "--suppress-secrets "
}

cmd := command{
Cmd: "bash",
Args: []string{"-c", "helm diff " + colorFlag + "upgrade " + r.Name + " " + r.Chart + getValuesFiles(r) + " --version " + strconv.Quote(r.Version) + " " + getSetValues(r) + getSetStringValues(r) + getDesiredTillerNamespaceFlag(r) + getTLSFlags(r) + getNoHooks(r)},
Args: []string{"-c", "helm diff " + colorFlag + suppressDiffSecretsFlag + "upgrade " + r.Name + " " + r.Chart + getValuesFiles(r) + " --version " + strconv.Quote(r.Version) + " " + getSetValues(r) + getSetStringValues(r) + getDesiredTillerNamespaceFlag(r) + getTLSFlags(r)},
Description: "diffing release [ " + r.Name + " ] using Tiller in [ " + getDesiredTillerNamespace(r) + " ]",
}

Expand Down
1 change: 1 addition & 0 deletions init.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func init() {
flag.BoolVar(&applyLabels, "apply-labels", false, "apply Helmsman labels to Helm state for all defined apps.")
flag.BoolVar(&keepUntrackedReleases, "keep-untracked-releases", false, "keep releases that are managed by Helmsman and are no longer tracked in your desired state.")
flag.BoolVar(&showDiff, "show-diff", false, "show helm diff results. Can expose sensitive information.")
flag.BoolVar(&suppressDiffSecrets, "suppress-diff-secrets", false, "don't show secrets in helm diff output.")

flag.Usage = printUsage
flag.Parse()
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var kubectlVersion string
var dryRun bool
var destroy bool
var showDiff bool
var suppressDiffSecrets bool

func main() {
// set the kubecontext to be used Or create it if it does not exist
Expand Down
2 changes: 1 addition & 1 deletion utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func fromYAML(file string, s *state) (bool, string) {
return false, err.Error()
}
yamlFile := []byte(substituteEnv(string(rawYamlFile)))
if err = yaml.Unmarshal(yamlFile, s); err != nil {
if err = yaml.UnmarshalStrict(yamlFile, s); err != nil {
return false, err.Error()
}

Expand Down

0 comments on commit 2795d3b

Please sign in to comment.