From 7015787d8f7c85e51cc45f92ac8111d02c846e0b Mon Sep 17 00:00:00 2001 From: Doug Winter Date: Wed, 2 May 2018 07:43:00 +0100 Subject: [PATCH] support tls for values file access - uses --ca-file / --cert-file / --key-file --- cmd/helm/install.go | 10 +++++----- cmd/helm/template.go | 2 +- cmd/helm/upgrade.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index d52dbc667..c0979bfa7 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -218,7 +218,7 @@ func (i *installCmd) run() error { i.namespace = defaultNamespace() } - rawVals, err := vals(i.valueFiles, i.values, i.stringValues) + rawVals, err := vals(i.valueFiles, i.values, i.stringValues, i.certFile, i.keyFile, i.caFile) if err != nil { return err } @@ -328,7 +328,7 @@ func mergeValues(dest map[string]interface{}, src map[string]interface{}) map[st // vals merges values from files specified via -f/--values and // directly via --set or --set-string, marshaling them to YAML -func vals(valueFiles valueFiles, values []string, stringValues []string) ([]byte, error) { +func vals(valueFiles valueFiles, values []string, stringValues []string, CertFile, KeyFile, CAFile string) ([]byte, error) { base := map[string]interface{}{} // User specified a values files via -f/--values @@ -340,7 +340,7 @@ func vals(valueFiles valueFiles, values []string, stringValues []string) ([]byte if strings.TrimSpace(filePath) == "-" { bytes, err = ioutil.ReadAll(os.Stdin) } else { - bytes, err = readFile(filePath) + bytes, err = readFile(filePath, CertFile, KeyFile, CAFile) } if err != nil { @@ -505,7 +505,7 @@ func checkDependencies(ch *chart.Chart, reqs *chartutil.Requirements) error { } //readFile load a file from the local directory or a remote file with a url. -func readFile(filePath string) ([]byte, error) { +func readFile(filePath, CertFile, KeyFile, CAFile string) ([]byte, error) { u, _ := url.Parse(filePath) p := getter.All(settings) @@ -516,7 +516,7 @@ func readFile(filePath string) ([]byte, error) { return ioutil.ReadFile(filePath) } - getter, err := getterConstructor(filePath, "", "", "") + getter, err := getterConstructor(filePath, CertFile, KeyFile, CAFile) if err != nil { return []byte{}, err } diff --git a/cmd/helm/template.go b/cmd/helm/template.go index fc1f44392..458df87b5 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -130,7 +130,7 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { t.namespace = defaultNamespace() } // get combined values and create config - rawVals, err := vals(t.valueFiles, t.values, t.stringValues) + rawVals, err := vals(t.valueFiles, t.values, t.stringValues, "", "", "") if err != nil { return err } diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 66c4a3657..9a4ba571e 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -195,7 +195,7 @@ func (u *upgradeCmd) run() error { } } - rawVals, err := vals(u.valueFiles, u.values, u.stringValues) + rawVals, err := vals(u.valueFiles, u.values, u.stringValues, "", "", "") if err != nil { return err }