From 084dff477ee73729dd24e7831d270fe0855d835b Mon Sep 17 00:00:00 2001 From: xuhaigang Date: Tue, 15 Aug 2017 13:27:20 +0800 Subject: [PATCH] feat(helm):Support reading the values file from STDIN We can use the command like
sed "s|foo|bar|g" values-template.yaml | helm install -f - stable/foo
This may be helpful in scripting. Closes #2709 --- cmd/helm/install.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index b480b0b93..7e59333b6 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -310,7 +310,14 @@ func vals(valueFiles valueFiles, values []string) ([]byte, error) { // User specified a values files via -f/--values for _, filePath := range valueFiles { currentMap := map[string]interface{}{} - bytes, err := ioutil.ReadFile(filePath) + + var bytes []byte + var err error + if strings.TrimSpace(filePath) == "-" { + bytes, err = ioutil.ReadAll(os.Stdin) + } else { + bytes, err = ioutil.ReadFile(filePath) + } if err != nil { return []byte{}, err }