docs: add skipSchemaValidation to index.md and update related structs (#1935)

* docs: add skipSchemaValidation to index.md and update related structs

Signed-off-by: yxxhero <aiopsclub@163.com>

* feat: add SkipSchemaValidation to config and state handling

Signed-off-by: yxxhero <aiopsclub@163.com>

---------

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2025-02-15 00:57:50 +08:00 committed by GitHub
parent e33b4725ea
commit 8b15c30cf2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 39 additions and 27 deletions

View File

@ -193,6 +193,8 @@ helmDefaults:
# verify the chart before upgrading (only works with packaged charts not directories) (default false) # verify the chart before upgrading (only works with packaged charts not directories) (default false)
verify: true verify: true
keyring: path/to/keyring.gpg keyring: path/to/keyring.gpg
# --skip-schema-validation flag to helm 'install', 'upgrade' and 'lint', starts with helm 3.16.0 (default false)
skipSchemaValidation: false
# wait for k8s resources via --wait. (default false) # wait for k8s resources via --wait. (default false)
wait: true wait: true
# if set and --wait enabled, will retry any failed check on resource state subject to the specified number of retries (default 0) # if set and --wait enabled, will retry any failed check on resource state subject to the specified number of retries (default 0)
@ -313,6 +315,8 @@ releases:
# Override helmDefaults options for verify, wait, waitForJobs, timeout, recreatePods and force. # Override helmDefaults options for verify, wait, waitForJobs, timeout, recreatePods and force.
verify: true verify: true
keyring: path/to/keyring.gpg keyring: path/to/keyring.gpg
# --skip-schema-validation flag to helm 'install', 'upgrade' and 'lint', starts with helm 3.16.0 (default false)
skipSchemaValidation: false
wait: true wait: true
waitRetries: 3 waitRetries: 3
waitForJobs: true waitForJobs: true

View File

@ -1441,6 +1441,7 @@ func (a *App) apply(r *Run, c ApplyConfigProvider) (bool, bool, []error) {
DiffArgs: c.DiffArgs(), DiffArgs: c.DiffArgs(),
PostRenderer: c.PostRenderer(), PostRenderer: c.PostRenderer(),
PostRendererArgs: c.PostRendererArgs(), PostRendererArgs: c.PostRendererArgs(),
SkipSchemaValidation: c.SkipSchemaValidation(),
SuppressOutputLineRegex: c.SuppressOutputLineRegex(), SuppressOutputLineRegex: c.SuppressOutputLineRegex(),
} }
@ -1943,18 +1944,19 @@ Do you really want to sync?
subst.Releases = rs subst.Releases = rs
opts := &state.SyncOpts{ opts := &state.SyncOpts{
Set: c.Set(), Set: c.Set(),
SkipCRDs: c.SkipCRDs(), SkipCRDs: c.SkipCRDs(),
Wait: c.Wait(), Wait: c.Wait(),
WaitRetries: c.WaitRetries(), WaitRetries: c.WaitRetries(),
WaitForJobs: c.WaitForJobs(), WaitForJobs: c.WaitForJobs(),
ReuseValues: c.ReuseValues(), ReuseValues: c.ReuseValues(),
ResetValues: c.ResetValues(), ResetValues: c.ResetValues(),
PostRenderer: c.PostRenderer(), PostRenderer: c.PostRenderer(),
PostRendererArgs: c.PostRendererArgs(), PostRendererArgs: c.PostRendererArgs(),
SyncArgs: c.SyncArgs(), SyncArgs: c.SyncArgs(),
HideNotes: c.HideNotes(), HideNotes: c.HideNotes(),
TakeOwnership: c.TakeOwnership(), TakeOwnership: c.TakeOwnership(),
SkipSchemaValidation: c.SkipSchemaValidation(),
} }
return subst.SyncReleases(&affectedReleases, helm, c.Values(), c.Concurrency(), opts) return subst.SyncReleases(&affectedReleases, helm, c.Values(), c.Concurrency(), opts)
})) }))
@ -1982,16 +1984,17 @@ func (a *App) template(r *Run, c TemplateConfigProvider) (bool, []error) {
} }
opts := &state.TemplateOpts{ opts := &state.TemplateOpts{
Set: c.Set(), Set: c.Set(),
IncludeCRDs: c.IncludeCRDs(), IncludeCRDs: c.IncludeCRDs(),
NoHooks: c.NoHooks(), NoHooks: c.NoHooks(),
OutputDirTemplate: c.OutputDirTemplate(), OutputDirTemplate: c.OutputDirTemplate(),
SkipCleanup: c.SkipCleanup(), SkipCleanup: c.SkipCleanup(),
SkipTests: c.SkipTests(), SkipTests: c.SkipTests(),
PostRenderer: c.PostRenderer(), PostRenderer: c.PostRenderer(),
PostRendererArgs: c.PostRendererArgs(), PostRendererArgs: c.PostRendererArgs(),
KubeVersion: c.KubeVersion(), KubeVersion: c.KubeVersion(),
ShowOnly: c.ShowOnly(), ShowOnly: c.ShowOnly(),
SkipSchemaValidation: c.SkipSchemaValidation(),
} }
return st.TemplateReleases(helm, c.OutputDir(), c.Values(), args, c.Concurrency(), c.Validate(), opts) 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 { type SyncConfigProvider interface {
Args() string Args() string
PostRenderer() string PostRenderer() string
SkipSchemaValidation() bool
PostRendererArgs() []string PostRendererArgs() []string
HideNotes() bool HideNotes() bool
TakeOwnership() bool TakeOwnership() bool
@ -239,6 +240,7 @@ type TemplateConfigProvider interface {
Args() string Args() string
PostRenderer() string PostRenderer() string
PostRendererArgs() []string PostRendererArgs() []string
SkipSchemaValidation() bool
Values() []string Values() []string
Set() []string Set() []string

View File

@ -54,7 +54,7 @@ type ApplyOptions struct {
WaitRetries int WaitRetries int
// WaitForJobs is true if the helm command should wait for the jobs to be completed // WaitForJobs is true if the helm command should wait for the jobs to be completed
WaitForJobs bool WaitForJobs bool
// Propagate '--skipSchemaValidation' to helmv3 template and helm install // Propagate '--skip-schema-validation' to helmv3 template and helm install
SkipSchemaValidation bool SkipSchemaValidation bool
// ReuseValues is true if the helm command should reuse the values // ReuseValues is true if the helm command should reuse the values
ReuseValues bool ReuseValues bool

View File

@ -32,7 +32,7 @@ type SyncOptions struct {
PostRenderer string PostRenderer string
// Propagate '--post-renderer-args' to helmv3 template and helm install // Propagate '--post-renderer-args' to helmv3 template and helm install
PostRendererArgs []string PostRendererArgs []string
// Propagate '--skipSchemaValidation' to helmv3 template and helm install // Propagate '--skip-schema-validation' to helmv3 template and helm install
SkipSchemaValidation bool SkipSchemaValidation bool
// Cascade '--cascade' to helmv3 delete, available values: background, foreground, or orphan, default: background // Cascade '--cascade' to helmv3 delete, available values: background, foreground, or orphan, default: background
Cascade string Cascade string

View File

@ -38,7 +38,7 @@ type TemplateOptions struct {
PostRenderer string PostRenderer string
// Propagate '--post-renderer-args' to helmv3 template and helm install // Propagate '--post-renderer-args' to helmv3 template and helm install
PostRendererArgs []string PostRendererArgs []string
// Propagate '--skipSchemaValidation' to helmv3 template and helm install // Propagate '--skip-schema-validation' to helmv3 template and helm install
SkipSchemaValidation bool SkipSchemaValidation bool
// KubeVersion is the kube-version flag // KubeVersion is the kube-version flag
KubeVersion string KubeVersion string

View File

@ -161,7 +161,7 @@ type HelmSpec struct {
Keyring string `yaml:"keyring,omitempty"` Keyring string `yaml:"keyring,omitempty"`
// EnableDNS, when set to true, enable DNS lookups when rendering templates // EnableDNS, when set to true, enable DNS lookups when rendering templates
EnableDNS bool `yaml:"enableDNS"` EnableDNS bool `yaml:"enableDNS"`
// Propagate '--skipSchemaValidation' to helmv3 template and helm install // Propagate '--skip-schema-validation' to helmv3 template and helm install
SkipSchemaValidation *bool `yaml:"skipSchemaValidation,omitempty"` SkipSchemaValidation *bool `yaml:"skipSchemaValidation,omitempty"`
// Devel, when set to true, use development versions, too. Equivalent to version '>0.0.0-0' // Devel, when set to true, use development versions, too. Equivalent to version '>0.0.0-0'
Devel bool `yaml:"devel"` Devel bool `yaml:"devel"`
@ -390,7 +390,7 @@ type ReleaseSpec struct {
// Propagate '--post-renderer' to helmv3 template and helm install // Propagate '--post-renderer' to helmv3 template and helm install
PostRenderer *string `yaml:"postRenderer,omitempty"` PostRenderer *string `yaml:"postRenderer,omitempty"`
// Propagate '--skipSchemaValidation' to helmv3 template and helm install // Propagate '--skip-schema-validation' to helmv3 template and helm install
SkipSchemaValidation *bool `yaml:"skipSchemaValidation,omitempty"` SkipSchemaValidation *bool `yaml:"skipSchemaValidation,omitempty"`
// Propagate '--post-renderer-args' to helmv3 template and helm install // Propagate '--post-renderer-args' to helmv3 template and helm install
@ -1492,6 +1492,8 @@ type TemplateOpts struct {
PostRendererArgs []string PostRendererArgs []string
KubeVersion string KubeVersion string
ShowOnly []string ShowOnly []string
// Propagate '--skip-schema-validation' to helmv3 template and helm install
SkipSchemaValidation bool
} }
type TemplateOpt interface{ Apply(*TemplateOpts) } 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.appendApiVersionsFlags(flags, release, kubeVersion)
flags = st.appendChartDownloadFlags(flags, release) flags = st.appendChartDownloadFlags(flags, release)
flags = st.appendShowOnlyFlags(flags, showOnly) flags = st.appendShowOnlyFlags(flags, showOnly)
flags = st.appendSkipSchemaValidationFlags(flags, release, opt.SkipSchemaValidation)
common, files, err := st.namespaceAndValuesFlags(helm, release, workerIndex) common, files, err := st.namespaceAndValuesFlags(helm, release, workerIndex)
if err != nil { if err != nil {