mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-09 13:35:52 +02:00
Add the option to specify an alternative helm binary (#181)
`helm` may not be version compatible. Add an option to specify an alternative `helm` command on runtime, possibly according to the version of tiller running on your cluster.
This commit is contained in:
+8
-2
@@ -11,6 +11,7 @@ const (
|
||||
)
|
||||
|
||||
type execer struct {
|
||||
helmBinary string
|
||||
runner Runner
|
||||
writer io.Writer
|
||||
kubeContext string
|
||||
@@ -20,6 +21,7 @@ type execer struct {
|
||||
// New for running helm commands
|
||||
func New(writer io.Writer, kubeContext string) *execer {
|
||||
return &execer{
|
||||
helmBinary: command,
|
||||
writer: writer,
|
||||
kubeContext: kubeContext,
|
||||
runner: &ShellRunner{},
|
||||
@@ -30,6 +32,10 @@ func (helm *execer) SetExtraArgs(args ...string) {
|
||||
helm.extra = args
|
||||
}
|
||||
|
||||
func (helm *execer) SetHelmBinary(bin string) {
|
||||
helm.helmBinary = bin
|
||||
}
|
||||
|
||||
func (helm *execer) AddRepo(name, repository, certfile, keyfile, username, password string) error {
|
||||
var args []string
|
||||
args = append(args, "repo", "add", name, repository)
|
||||
@@ -114,8 +120,8 @@ func (helm *execer) exec(args ...string) ([]byte, error) {
|
||||
if helm.kubeContext != "" {
|
||||
cmdargs = append(cmdargs, "--kube-context", helm.kubeContext)
|
||||
}
|
||||
helm.write([]byte(fmt.Sprintf("exec: helm %s\n", strings.Join(cmdargs, " "))))
|
||||
return helm.runner.Execute(command, cmdargs)
|
||||
helm.write([]byte(fmt.Sprintf("exec: %s %s\n", helm.helmBinary, strings.Join(cmdargs, " "))))
|
||||
return helm.runner.Execute(helm.helmBinary, cmdargs)
|
||||
}
|
||||
|
||||
func (helm *execer) write(out []byte) {
|
||||
|
||||
Reference in New Issue
Block a user