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: true
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: true
# 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.
verify: true
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
waitRetries: 3
waitForJobs: true

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(),
}
@ -1943,18 +1944,19 @@ Do you really want to sync?
subst.Releases = rs
opts := &state.SyncOpts{
Set: c.Set(),
SkipCRDs: c.SkipCRDs(),
Wait: c.Wait(),
WaitRetries: c.WaitRetries(),
WaitForJobs: c.WaitForJobs(),
ReuseValues: c.ReuseValues(),
ResetValues: c.ResetValues(),
PostRenderer: c.PostRenderer(),
PostRendererArgs: c.PostRendererArgs(),
SyncArgs: c.SyncArgs(),
HideNotes: c.HideNotes(),
TakeOwnership: c.TakeOwnership(),
Set: c.Set(),
SkipCRDs: c.SkipCRDs(),
Wait: c.Wait(),
WaitRetries: c.WaitRetries(),
WaitForJobs: c.WaitForJobs(),
ReuseValues: c.ReuseValues(),
ResetValues: c.ResetValues(),
PostRenderer: c.PostRenderer(),
PostRendererArgs: c.PostRendererArgs(),
SyncArgs: c.SyncArgs(),
HideNotes: c.HideNotes(),
TakeOwnership: c.TakeOwnership(),
SkipSchemaValidation: c.SkipSchemaValidation(),
}
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{
Set: c.Set(),
IncludeCRDs: c.IncludeCRDs(),
NoHooks: c.NoHooks(),
OutputDirTemplate: c.OutputDirTemplate(),
SkipCleanup: c.SkipCleanup(),
SkipTests: c.SkipTests(),
PostRenderer: c.PostRenderer(),
PostRendererArgs: c.PostRendererArgs(),
KubeVersion: c.KubeVersion(),
ShowOnly: c.ShowOnly(),
Set: c.Set(),
IncludeCRDs: c.IncludeCRDs(),
NoHooks: c.NoHooks(),
OutputDirTemplate: c.OutputDirTemplate(),
SkipCleanup: c.SkipCleanup(),
SkipTests: c.SkipTests(),
PostRenderer: c.PostRenderer(),
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

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

View File

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

View File

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

View File

@ -161,7 +161,7 @@ type HelmSpec struct {
Keyring string `yaml:"keyring,omitempty"`
// EnableDNS, when set to true, enable DNS lookups when rendering templates
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"`
// Devel, when set to true, use development versions, too. Equivalent to version '>0.0.0-0'
Devel bool `yaml:"devel"`
@ -390,7 +390,7 @@ type ReleaseSpec struct {
// Propagate '--post-renderer' to helmv3 template and helm install
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"`
// Propagate '--post-renderer-args' to helmv3 template and helm install
@ -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 {