provide --template-args as parameter to allow overwriting, defaults to --sry-run=server for sync and apply
Signed-off-by: Kerstin Albers <kerstinzuzej@gmail.com>
This commit is contained in:
parent
f53fb4f37f
commit
f05d0c71e6
|
|
@ -67,6 +67,7 @@ func NewApplyCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
f.BoolVar(&applyOptions.SkipSchemaValidation, "skip-schema-validation", false, `pass --skip-schema-validation to "helm template" or "helm upgrade --install"`)
|
f.BoolVar(&applyOptions.SkipSchemaValidation, "skip-schema-validation", false, `pass --skip-schema-validation to "helm template" or "helm upgrade --install"`)
|
||||||
f.StringVar(&applyOptions.Cascade, "cascade", "", "pass cascade to helm exec, default: background")
|
f.StringVar(&applyOptions.Cascade, "cascade", "", "pass cascade to helm exec, default: background")
|
||||||
f.StringArrayVar(&applyOptions.SuppressOutputLineRegex, "suppress-output-line-regex", nil, "a list of regex patterns to suppress output lines from the diff output")
|
f.StringArrayVar(&applyOptions.SuppressOutputLineRegex, "suppress-output-line-regex", nil, "a list of regex patterns to suppress output lines from the diff output")
|
||||||
|
f.StringVar(&applyOptions.TemplateArgs, "template-args", "--dry-run=server", `pass extra args to helm template during chartify pre-render (default: --dry-run=server)`)
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ func NewSyncCmd(globalCfg *config.GlobalImpl) *cobra.Command {
|
||||||
f.StringArrayVar(&syncOptions.PostRendererArgs, "post-renderer-args", nil, `pass --post-renderer-args to "helm template" or "helm upgrade --install"`)
|
f.StringArrayVar(&syncOptions.PostRendererArgs, "post-renderer-args", nil, `pass --post-renderer-args to "helm template" or "helm upgrade --install"`)
|
||||||
f.BoolVar(&syncOptions.SkipSchemaValidation, "skip-schema-validation", false, `pass --skip-schema-validation to "helm template" or "helm upgrade --install"`)
|
f.BoolVar(&syncOptions.SkipSchemaValidation, "skip-schema-validation", false, `pass --skip-schema-validation to "helm template" or "helm upgrade --install"`)
|
||||||
f.StringVar(&syncOptions.Cascade, "cascade", "", "pass cascade to helm exec, default: background")
|
f.StringVar(&syncOptions.Cascade, "cascade", "", "pass cascade to helm exec, default: background")
|
||||||
|
f.StringVar(&syncOptions.TemplateArgs, "template-args", "--dry-run=server", `pass extra args to helm template during chartify pre-render (default: --dry-run=server)`)
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -371,8 +371,7 @@ func (a *App) Sync(c SyncConfigProvider) error {
|
||||||
IncludeTransitiveNeeds: c.IncludeNeeds(),
|
IncludeTransitiveNeeds: c.IncludeNeeds(),
|
||||||
Validate: c.Validate(),
|
Validate: c.Validate(),
|
||||||
Concurrency: c.Concurrency(),
|
Concurrency: c.Concurrency(),
|
||||||
// Ensure lookup during chartify pre-render connects to cluster
|
TemplateArgs: c.TemplateArgs(),
|
||||||
TemplateArgs: "--dry-run=server",
|
|
||||||
}, func() {
|
}, func() {
|
||||||
ok, errs = a.sync(run, c)
|
ok, errs = a.sync(run, c)
|
||||||
})
|
})
|
||||||
|
|
@ -409,8 +408,8 @@ func (a *App) Apply(c ApplyConfigProvider) error {
|
||||||
Validate: c.Validate(),
|
Validate: c.Validate(),
|
||||||
Concurrency: c.Concurrency(),
|
Concurrency: c.Concurrency(),
|
||||||
IncludeTransitiveNeeds: c.IncludeNeeds(),
|
IncludeTransitiveNeeds: c.IncludeNeeds(),
|
||||||
// Ensure lookup during chartify pre-render connects to cluster
|
// Use user-provided template args; default is set via flag ("--dry-run=server")
|
||||||
TemplateArgs: "--dry-run=server",
|
TemplateArgs: c.TemplateArgs(),
|
||||||
}, func() {
|
}, func() {
|
||||||
matched, updated, es := a.apply(run, c)
|
matched, updated, es := a.apply(run, c)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,7 @@ type SyncConfigProvider interface {
|
||||||
IncludeTransitiveNeeds() bool
|
IncludeTransitiveNeeds() bool
|
||||||
|
|
||||||
SyncReleaseLabels() bool
|
SyncReleaseLabels() bool
|
||||||
|
TemplateArgs() string
|
||||||
|
|
||||||
DAGConfig
|
DAGConfig
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,8 @@ type ApplyOptions struct {
|
||||||
TakeOwnership bool
|
TakeOwnership bool
|
||||||
|
|
||||||
SyncReleaseLabels bool
|
SyncReleaseLabels bool
|
||||||
|
// TemplateArgs for chartify pre-render (default provided by CLI flag)
|
||||||
|
TemplateArgs string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewApply creates a new Apply
|
// NewApply creates a new Apply
|
||||||
|
|
@ -253,9 +255,9 @@ func (a *ApplyImpl) SuppressOutputLineRegex() []string {
|
||||||
return a.ApplyOptions.SuppressOutputLineRegex
|
return a.ApplyOptions.SuppressOutputLineRegex
|
||||||
}
|
}
|
||||||
|
|
||||||
// TemplateArgs returns extra args for helm template; not applicable to apply, return empty.
|
// TemplateArgs returns extra args for helm template
|
||||||
func (a *ApplyImpl) TemplateArgs() string {
|
func (a *ApplyImpl) TemplateArgs() string {
|
||||||
return ""
|
return a.ApplyOptions.TemplateArgs
|
||||||
}
|
}
|
||||||
|
|
||||||
// SyncArgs returns the SyncArgs.
|
// SyncArgs returns the SyncArgs.
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,9 @@ type SyncOptions struct {
|
||||||
TakeOwnership bool
|
TakeOwnership bool
|
||||||
// SyncReleaseLabels is the sync release labels flag
|
// SyncReleaseLabels is the sync release labels flag
|
||||||
SyncReleaseLabels bool
|
SyncReleaseLabels bool
|
||||||
|
// TemplateArgs are extra args appended to helm template during chartify pre-render for sync
|
||||||
|
// Defaults to "--dry-run=server" via flag.
|
||||||
|
TemplateArgs string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSyncOptions creates a new Apply
|
// NewSyncOptions creates a new Apply
|
||||||
|
|
@ -180,3 +183,7 @@ func (t *SyncImpl) TakeOwnership() bool {
|
||||||
func (t *SyncImpl) SyncReleaseLabels() bool {
|
func (t *SyncImpl) SyncReleaseLabels() bool {
|
||||||
return t.SyncOptions.SyncReleaseLabels
|
return t.SyncOptions.SyncReleaseLabels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *SyncImpl) TemplateArgs() string {
|
||||||
|
return t.SyncOptions.TemplateArgs
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue