Add ability to specify and override helmDefaults.wait via cli (#1678)
This commit is contained in:
parent
f24b61f100
commit
bd3838c059
12
main.go
12
main.go
|
|
@ -353,6 +353,10 @@ func main() {
|
||||||
Name: "skip-deps",
|
Name: "skip-deps",
|
||||||
Usage: `skip running "helm repo update" and "helm dependency build"`,
|
Usage: `skip running "helm repo update" and "helm dependency build"`,
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "wait",
|
||||||
|
Usage: `Override helmDefaults.wait setting "helm upgrade --install --wait"`,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Action: action(func(run *app.App, c configImpl) error {
|
Action: action(func(run *app.App, c configImpl) error {
|
||||||
return run.Sync(c)
|
return run.Sync(c)
|
||||||
|
|
@ -417,6 +421,10 @@ func main() {
|
||||||
Name: "skip-deps",
|
Name: "skip-deps",
|
||||||
Usage: `skip running "helm repo update" and "helm dependency build"`,
|
Usage: `skip running "helm repo update" and "helm dependency build"`,
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "wait",
|
||||||
|
Usage: `Override helmDefaults.wait setting "helm upgrade --install --wait"`,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Action: action(func(run *app.App, c configImpl) error {
|
Action: action(func(run *app.App, c configImpl) error {
|
||||||
return run.Apply(c)
|
return run.Apply(c)
|
||||||
|
|
@ -603,6 +611,10 @@ func (c configImpl) SkipRepos() bool {
|
||||||
return c.c.Bool("skip-repos")
|
return c.c.Bool("skip-repos")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c configImpl) Wait() bool {
|
||||||
|
return c.c.Bool("wait")
|
||||||
|
}
|
||||||
|
|
||||||
func (c configImpl) Values() []string {
|
func (c configImpl) Values() []string {
|
||||||
return c.c.StringSlice("values")
|
return c.c.StringSlice("values")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -294,6 +294,7 @@ func (a *App) Sync(c SyncConfigProvider) error {
|
||||||
prepErr := run.withPreparedCharts("sync", state.ChartPrepareOptions{
|
prepErr := run.withPreparedCharts("sync", state.ChartPrepareOptions{
|
||||||
SkipRepos: c.SkipDeps(),
|
SkipRepos: c.SkipDeps(),
|
||||||
SkipDeps: c.SkipDeps(),
|
SkipDeps: c.SkipDeps(),
|
||||||
|
Wait: c.Wait(),
|
||||||
}, func() {
|
}, func() {
|
||||||
ok, errs = a.sync(run, c)
|
ok, errs = a.sync(run, c)
|
||||||
})
|
})
|
||||||
|
|
@ -319,6 +320,7 @@ func (a *App) Apply(c ApplyConfigProvider) error {
|
||||||
prepErr := run.withPreparedCharts("apply", state.ChartPrepareOptions{
|
prepErr := run.withPreparedCharts("apply", state.ChartPrepareOptions{
|
||||||
SkipRepos: c.SkipDeps(),
|
SkipRepos: c.SkipDeps(),
|
||||||
SkipDeps: c.SkipDeps(),
|
SkipDeps: c.SkipDeps(),
|
||||||
|
Wait: c.Wait(),
|
||||||
}, func() {
|
}, func() {
|
||||||
matched, updated, es := a.apply(run, c)
|
matched, updated, es := a.apply(run, c)
|
||||||
|
|
||||||
|
|
@ -1179,6 +1181,7 @@ Do you really want to apply?
|
||||||
syncOpts := state.SyncOpts{
|
syncOpts := state.SyncOpts{
|
||||||
Set: c.Set(),
|
Set: c.Set(),
|
||||||
SkipCleanup: c.RetainValuesFiles() || c.SkipCleanup(),
|
SkipCleanup: c.RetainValuesFiles() || c.SkipCleanup(),
|
||||||
|
Wait: c.Wait(),
|
||||||
}
|
}
|
||||||
return subst.SyncReleases(&affectedReleases, helm, c.Values(), c.Concurrency(), &syncOpts)
|
return subst.SyncReleases(&affectedReleases, helm, c.Values(), c.Concurrency(), &syncOpts)
|
||||||
}))
|
}))
|
||||||
|
|
@ -1393,7 +1396,8 @@ func (a *App) sync(r *Run, c SyncConfigProvider) (bool, []error) {
|
||||||
subst.Releases = rs
|
subst.Releases = rs
|
||||||
|
|
||||||
opts := &state.SyncOpts{
|
opts := &state.SyncOpts{
|
||||||
Set: c.Set(),
|
Set: c.Set(),
|
||||||
|
Wait: c.Wait(),
|
||||||
}
|
}
|
||||||
return subst.SyncReleases(&affectedReleases, helm, c.Values(), c.Concurrency(), opts)
|
return subst.SyncReleases(&affectedReleases, helm, c.Values(), c.Concurrency(), opts)
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -2315,12 +2315,17 @@ type applyConfig struct {
|
||||||
interactive bool
|
interactive bool
|
||||||
skipDiffOnInstall bool
|
skipDiffOnInstall bool
|
||||||
logger *zap.SugaredLogger
|
logger *zap.SugaredLogger
|
||||||
|
wait bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a applyConfig) Args() string {
|
func (a applyConfig) Args() string {
|
||||||
return a.args
|
return a.args
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a applyConfig) Wait() bool {
|
||||||
|
return a.wait
|
||||||
|
}
|
||||||
|
|
||||||
func (a applyConfig) Values() []string {
|
func (a applyConfig) Values() []string {
|
||||||
return a.values
|
return a.values
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ type ApplyConfigProvider interface {
|
||||||
Values() []string
|
Values() []string
|
||||||
Set() []string
|
Set() []string
|
||||||
SkipDeps() bool
|
SkipDeps() bool
|
||||||
|
Wait() bool
|
||||||
|
|
||||||
IncludeTests() bool
|
IncludeTests() bool
|
||||||
|
|
||||||
|
|
@ -65,6 +66,7 @@ type SyncConfigProvider interface {
|
||||||
Values() []string
|
Values() []string
|
||||||
Set() []string
|
Set() []string
|
||||||
SkipDeps() bool
|
SkipDeps() bool
|
||||||
|
Wait() bool
|
||||||
|
|
||||||
concurrencyConfig
|
concurrencyConfig
|
||||||
loggingConfig
|
loggingConfig
|
||||||
|
|
|
||||||
|
|
@ -504,6 +504,10 @@ func (st *HelmState) prepareSyncReleases(helm helmexec.Interface, additionalValu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if opts.Wait {
|
||||||
|
flags = append(flags, "--wait")
|
||||||
|
}
|
||||||
|
|
||||||
if len(errs) > 0 {
|
if len(errs) > 0 {
|
||||||
results <- syncPrepareResult{errors: errs, files: files}
|
results <- syncPrepareResult{errors: errs, files: files}
|
||||||
continue
|
continue
|
||||||
|
|
@ -578,6 +582,7 @@ func (st *HelmState) DetectReleasesToBeDeleted(helm helmexec.Interface, releases
|
||||||
type SyncOpts struct {
|
type SyncOpts struct {
|
||||||
Set []string
|
Set []string
|
||||||
SkipCleanup bool
|
SkipCleanup bool
|
||||||
|
Wait bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type SyncOpt interface{ Apply(*SyncOpts) }
|
type SyncOpt interface{ Apply(*SyncOpts) }
|
||||||
|
|
@ -876,6 +881,7 @@ type ChartPrepareOptions struct {
|
||||||
SkipRepos bool
|
SkipRepos bool
|
||||||
SkipDeps bool
|
SkipDeps bool
|
||||||
SkipResolve bool
|
SkipResolve bool
|
||||||
|
Wait bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type chartPrepareResult struct {
|
type chartPrepareResult struct {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue