feat: add SkipSchemaValidation to config and state handling

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2025-02-14 22:05:39 +08:00
parent 78bbc6a584
commit 2e8df93f1c
3 changed files with 30 additions and 22 deletions

View File

@ -1441,6 +1441,7 @@ func (a *App) apply(r *Run, c ApplyConfigProvider) (bool, bool, []error) {
DiffArgs: c.DiffArgs(),
PostRenderer: c.PostRenderer(),
PostRendererArgs: c.PostRendererArgs(),
SkipSchemaValidation: c.SkipSchemaValidation(),
SuppressOutputLineRegex: c.SuppressOutputLineRegex(),
}
@ -1955,6 +1956,7 @@ Do you really want to sync?
SyncArgs: c.SyncArgs(),
HideNotes: c.HideNotes(),
TakeOwnership: c.TakeOwnership(),
SkipSchemaValidation: c.SkipSchemaValidation(),
}
return subst.SyncReleases(&affectedReleases, helm, c.Values(), c.Concurrency(), opts)
}))
@ -1992,6 +1994,7 @@ func (a *App) template(r *Run, c TemplateConfigProvider) (bool, []error) {
PostRendererArgs: c.PostRendererArgs(),
KubeVersion: c.KubeVersion(),
ShowOnly: c.ShowOnly(),
SkipSchemaValidation: c.SkipSchemaValidation(),
}
return st.TemplateReleases(helm, c.OutputDir(), c.Values(), args, c.Concurrency(), c.Validate(), opts)
})

View File

@ -103,6 +103,7 @@ type ApplyConfigProvider interface {
type SyncConfigProvider interface {
Args() string
PostRenderer() string
SkipSchemaValidation() bool
PostRendererArgs() []string
HideNotes() bool
TakeOwnership() bool
@ -239,6 +240,7 @@ type TemplateConfigProvider interface {
Args() string
PostRenderer() string
PostRendererArgs() []string
SkipSchemaValidation() bool
Values() []string
Set() []string

View File

@ -1492,6 +1492,8 @@ type TemplateOpts struct {
PostRendererArgs []string
KubeVersion string
ShowOnly []string
// Propagate '--skip-schema-validation' to helmv3 template and helm install
SkipSchemaValidation bool
}
type TemplateOpt interface{ Apply(*TemplateOpts) }
@ -2837,6 +2839,7 @@ func (st *HelmState) flagsForTemplate(helm helmexec.Interface, release *ReleaseS
flags = st.appendApiVersionsFlags(flags, release, kubeVersion)
flags = st.appendChartDownloadFlags(flags, release)
flags = st.appendShowOnlyFlags(flags, showOnly)
flags = st.appendSkipSchemaValidationFlags(flags, release, opt.SkipSchemaValidation)
common, files, err := st.namespaceAndValuesFlags(helm, release, workerIndex)
if err != nil {