added support for environment variables, adding value files during runtime and a global kube-context flag to pass down to helm

This commit is contained in:
Nathan Vecchiarelli
2017-04-11 19:55:23 -04:00
parent 4674af9608
commit 373e750642
3 changed files with 48 additions and 6 deletions
+9 -2
View File
@@ -15,11 +15,15 @@ const (
type execer struct {
writer io.Writer
kubeContext string
extra []string
}
func NewHelmExec(writer io.Writer) Interface {
return &execer{writer: writer}
func NewHelmExec(writer io.Writer, kubeContext string) Interface {
return &execer{
writer: writer,
kubeContext: kubeContext,
}
}
func (helm *execer) SetExtraArgs(args ...string) {
@@ -69,6 +73,9 @@ func (helm *execer) exec(args ...string) ([]byte, error) {
if len(helm.extra) > 0 {
cmdargs = append(cmdargs, helm.extra...)
}
if helm.kubeContext != "" {
cmdargs = append(cmdargs, "--kube-context", helm.kubeContext)
}
if helm.writer != nil {
helm.writer.Write([]byte(fmt.Sprintf("exec: helm %s\n", strings.Join(cmdargs, " "))))
}