feat: add SkipSchemaValidation to config and state handling
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
		
							parent
							
								
									78bbc6a584
								
							
						
					
					
						commit
						2e8df93f1c
					
				|  | @ -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) | ||||||
| 	}) | 	}) | ||||||
|  |  | ||||||
|  | @ -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 | ||||||
|  |  | ||||||
|  | @ -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 { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue