Skip to content

Commit

Permalink
Set helm extra args early
Browse files Browse the repository at this point in the history
The extra aguments for helm are set pretty late which leads to errors
then using `helmDefauls.args: "--kubeconfig ..."` as thats needed for
helm commands run earlier in the code as well.
  • Loading branch information
jayme-github committed Aug 11, 2020
1 parent 9a03d79 commit de53809
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pkg/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,7 @@ func (a *App) getSelectedReleases(r *Run) ([]state.ReleaseSpec, error) {
func (a *App) apply(r *Run, c ApplyConfigProvider) (bool, bool, []error) {
st := r.state
helm := r.helm
helm.SetExtraArgs(argparser.GetArgs(c.Args(), st)...)

allReleases := st.GetReleasesWithOverrides()

Expand Down Expand Up @@ -1031,8 +1032,6 @@ Do you really want to apply?
st.Releases = allReleases

if !interactive || interactive && r.askForConfirmation(confMsg) {
r.helm.SetExtraArgs(argparser.GetArgs(c.Args(), r.state)...)

// We deleted releases by traversing the DAG in reverse order
if len(releasesToBeDeleted) > 0 {
_, deletionErrs := withDAG(st, helm, a.Logger, true, a.Wrap(func(subst *state.HelmState, helm helmexec.Interface) []error {
Expand Down Expand Up @@ -1086,6 +1085,7 @@ Do you really want to apply?
func (a *App) delete(r *Run, purge bool, c DestroyConfigProvider) (bool, []error) {
st := r.state
helm := r.helm
helm.SetExtraArgs(argparser.GetArgs(c.Args(), st)...)

affectedReleases := state.AffectedReleases{}

Expand Down Expand Up @@ -1140,8 +1140,6 @@ Do you really want to delete?
`, strings.Join(names, "\n"))
interactive := c.Interactive()
if !interactive || interactive && r.askForConfirmation(msg) {
r.helm.SetExtraArgs(argparser.GetArgs(c.Args(), r.state)...)

if len(releasesToDelete) > 0 {
_, deletionErrs := withDAG(st, helm, a.Logger, true, a.Wrap(func(subst *state.HelmState, helm helmexec.Interface) []error {
var rs []state.ReleaseSpec
Expand Down Expand Up @@ -1169,6 +1167,7 @@ Do you really want to delete?
func (a *App) sync(r *Run, c SyncConfigProvider) (bool, []error) {
st := r.state
helm := r.helm
helm.SetExtraArgs(argparser.GetArgs(c.Args(), st)...)

allReleases := st.GetReleasesWithOverrides()

Expand Down Expand Up @@ -1243,8 +1242,6 @@ func (a *App) sync(r *Run, c SyncConfigProvider) (bool, []error) {

var errs []error

r.helm.SetExtraArgs(argparser.GetArgs(c.Args(), r.state)...)

// Traverse DAG of all the releases so that we don't suffer from false-positive missing dependencies
st.Releases = allReleases

Expand Down

0 comments on commit de53809

Please sign in to comment.