mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-18 17:52:29 +02:00
Add --kubeconfig flag (#1381)
add kubeconfig flag Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
This commit is contained in:
+4
-1
@@ -37,6 +37,7 @@ type App struct {
|
||||
DisableForceUpdate bool
|
||||
|
||||
Logger *zap.SugaredLogger
|
||||
Kubeconfig string
|
||||
Env string
|
||||
Namespace string
|
||||
Chart string
|
||||
@@ -81,6 +82,7 @@ func New(conf ConfigProvider) *App {
|
||||
StripArgsValuesOnExitError: conf.StripArgsValuesOnExitError(),
|
||||
DisableForceUpdate: conf.DisableForceUpdate(),
|
||||
Logger: conf.Logger(),
|
||||
Kubeconfig: conf.Kubeconfig(),
|
||||
Env: conf.Env(),
|
||||
Namespace: conf.Namespace(),
|
||||
Chart: conf.Chart(),
|
||||
@@ -789,12 +791,13 @@ func (a *App) getHelm(st *state.HelmState) helmexec.Interface {
|
||||
}
|
||||
|
||||
bin := st.DefaultHelmBinary
|
||||
kubeconfig := a.Kubeconfig
|
||||
kubectx := st.HelmDefaults.KubeContext
|
||||
|
||||
key := createHelmKey(bin, kubectx)
|
||||
|
||||
if _, ok := a.helms[key]; !ok {
|
||||
a.helms[key] = helmexec.New(bin, helmexec.HelmExecOptions{EnableLiveOutput: a.EnableLiveOutput, DisableForceUpdate: a.DisableForceUpdate}, a.Logger, kubectx, &helmexec.ShellRunner{
|
||||
a.helms[key] = helmexec.New(bin, helmexec.HelmExecOptions{EnableLiveOutput: a.EnableLiveOutput, DisableForceUpdate: a.DisableForceUpdate}, a.Logger, kubeconfig, kubectx, &helmexec.ShellRunner{
|
||||
Logger: a.Logger,
|
||||
Ctx: a.ctx,
|
||||
StripArgsValuesOnExitError: a.StripArgsValuesOnExitError,
|
||||
|
||||
+1
-1
@@ -2441,7 +2441,7 @@ func (mock *mockRunner) Execute(cmd string, args []string, env map[string]string
|
||||
}
|
||||
|
||||
func MockExecer(logger *zap.SugaredLogger, kubeContext string) helmexec.Interface {
|
||||
execer := helmexec.New("helm", helmexec.HelmExecOptions{}, logger, kubeContext, &mockRunner{})
|
||||
execer := helmexec.New("helm", helmexec.HelmExecOptions{}, logger, "", kubeContext, &mockRunner{})
|
||||
return execer
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ type ConfigProvider interface {
|
||||
Selectors() []string
|
||||
StateValuesSet() map[string]any
|
||||
StateValuesFiles() []string
|
||||
Kubeconfig() string
|
||||
Env() string
|
||||
|
||||
loggingConfig
|
||||
|
||||
+1
-1
@@ -163,7 +163,7 @@ func (h *HelmfileInit) WhetherContinue(ask string) error {
|
||||
|
||||
func (h *HelmfileInit) CheckHelmPlugins() error {
|
||||
settings := cli.New()
|
||||
helm := helmexec.New(h.helmBinary, helmexec.HelmExecOptions{}, h.logger, "", h.runner)
|
||||
helm := helmexec.New(h.helmBinary, helmexec.HelmExecOptions{}, h.logger, "", "", h.runner)
|
||||
for _, p := range helmPlugins {
|
||||
pluginVersion, err := helmexec.GetPluginVersion(p.name, settings.PluginsDirectory)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user