Add `--skip-crds` to `helmfile sync` and `helmfile apply` (#1771)
Resolves #1770
This commit is contained in:
		
							parent
							
								
									589b26aaad
								
							
						
					
					
						commit
						a111e89b27
					
				
							
								
								
									
										12
									
								
								main.go
								
								
								
								
							
							
						
						
									
										12
									
								
								main.go
								
								
								
								
							|  | @ -378,6 +378,10 @@ func main() { | ||||||
| 					Value: "", | 					Value: "", | ||||||
| 					Usage: "pass args to helm exec", | 					Usage: "pass args to helm exec", | ||||||
| 				}, | 				}, | ||||||
|  | 				cli.BoolFlag{ | ||||||
|  | 					Name:  "skip-crds", | ||||||
|  | 					Usage: "if set, no CRDs will be installed on sync. By default, CRDs are installed if not already present", | ||||||
|  | 				}, | ||||||
| 				cli.BoolFlag{ | 				cli.BoolFlag{ | ||||||
| 					Name:  "skip-deps", | 					Name:  "skip-deps", | ||||||
| 					Usage: `skip running "helm repo update" and "helm dependency build"`, | 					Usage: `skip running "helm repo update" and "helm dependency build"`, | ||||||
|  | @ -434,6 +438,10 @@ func main() { | ||||||
| 					Name:  "skip-cleanup", | 					Name:  "skip-cleanup", | ||||||
| 					Usage: "Stop cleaning up temporary values generated by helmfile and helm-secrets. Useful for debugging. Don't use in production for security", | 					Usage: "Stop cleaning up temporary values generated by helmfile and helm-secrets. Useful for debugging. Don't use in production for security", | ||||||
| 				}, | 				}, | ||||||
|  | 				cli.BoolFlag{ | ||||||
|  | 					Name:  "skip-crds", | ||||||
|  | 					Usage: "if set, no CRDs will be installed on sync. By default, CRDs are installed if not already present", | ||||||
|  | 				}, | ||||||
| 				cli.BoolFlag{ | 				cli.BoolFlag{ | ||||||
| 					Name:  "skip-diff-on-install", | 					Name:  "skip-diff-on-install", | ||||||
| 					Usage: "Skips running helm-diff on releases being newly installed on this apply. Useful when the release manifests are too huge to be reviewed, or it's too time-consuming to diff at all", | 					Usage: "Skips running helm-diff on releases being newly installed on this apply. Useful when the release manifests are too huge to be reviewed, or it's too time-consuming to diff at all", | ||||||
|  | @ -815,6 +823,10 @@ func (c configImpl) SkipCleanup() bool { | ||||||
| 	return c.c.Bool("skip-cleanup") | 	return c.c.Bool("skip-cleanup") | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (c configImpl) SkipCRDs() bool { | ||||||
|  | 	return c.c.Bool("skip-crds") | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func (c configImpl) SkipDiffOnInstall() bool { | func (c configImpl) SkipDiffOnInstall() bool { | ||||||
| 	return c.c.Bool("skip-diff-on-install") | 	return c.c.Bool("skip-diff-on-install") | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1200,6 +1200,7 @@ Do you really want to apply? | ||||||
| 				syncOpts := state.SyncOpts{ | 				syncOpts := state.SyncOpts{ | ||||||
| 					Set:         c.Set(), | 					Set:         c.Set(), | ||||||
| 					SkipCleanup: c.RetainValuesFiles() || c.SkipCleanup(), | 					SkipCleanup: c.RetainValuesFiles() || c.SkipCleanup(), | ||||||
|  | 					SkipCRDs:    c.SkipCRDs(), | ||||||
| 					Wait:        c.Wait(), | 					Wait:        c.Wait(), | ||||||
| 					WaitForJobs: c.WaitForJobs(), | 					WaitForJobs: c.WaitForJobs(), | ||||||
| 				} | 				} | ||||||
|  | @ -1595,6 +1596,7 @@ func (a *App) sync(r *Run, c SyncConfigProvider) (bool, []error) { | ||||||
| 
 | 
 | ||||||
| 			opts := &state.SyncOpts{ | 			opts := &state.SyncOpts{ | ||||||
| 				Set:         c.Set(), | 				Set:         c.Set(), | ||||||
|  | 				SkipCRDs:    c.SkipCRDs(), | ||||||
| 				Wait:        c.Wait(), | 				Wait:        c.Wait(), | ||||||
| 				WaitForJobs: c.WaitForJobs(), | 				WaitForJobs: c.WaitForJobs(), | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | @ -2243,6 +2243,7 @@ type configImpl struct { | ||||||
| 	output      string | 	output      string | ||||||
| 	includeCRDs bool | 	includeCRDs bool | ||||||
| 	skipCleanup bool | 	skipCleanup bool | ||||||
|  | 	skipCRDs    bool | ||||||
| 	skipDeps    bool | 	skipDeps    bool | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -2270,6 +2271,10 @@ func (c configImpl) SkipCleanup() bool { | ||||||
| 	return c.skipCleanup | 	return c.skipCleanup | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (c configImpl) SkipCRDs() bool { | ||||||
|  | 	return c.skipCRDs | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func (c configImpl) SkipDeps() bool { | func (c configImpl) SkipDeps() bool { | ||||||
| 	return c.skipDeps | 	return c.skipDeps | ||||||
| } | } | ||||||
|  | @ -2305,6 +2310,7 @@ type applyConfig struct { | ||||||
| 	set               []string | 	set               []string | ||||||
| 	validate          bool | 	validate          bool | ||||||
| 	skipCleanup       bool | 	skipCleanup       bool | ||||||
|  | 	skipCRDs          bool | ||||||
| 	skipDeps          bool | 	skipDeps          bool | ||||||
| 	includeTests      bool | 	includeTests      bool | ||||||
| 	suppressSecrets   bool | 	suppressSecrets   bool | ||||||
|  | @ -2349,6 +2355,10 @@ func (a applyConfig) SkipCleanup() bool { | ||||||
| 	return a.skipCleanup | 	return a.skipCleanup | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (a applyConfig) SkipCRDs() bool { | ||||||
|  | 	return a.skipCRDs | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func (a applyConfig) SkipDeps() bool { | func (a applyConfig) SkipDeps() bool { | ||||||
| 	return a.skipDeps | 	return a.skipDeps | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -39,6 +39,7 @@ type ApplyConfigProvider interface { | ||||||
| 
 | 
 | ||||||
| 	Values() []string | 	Values() []string | ||||||
| 	Set() []string | 	Set() []string | ||||||
|  | 	SkipCRDs() bool | ||||||
| 	SkipDeps() bool | 	SkipDeps() bool | ||||||
| 	Wait() bool | 	Wait() bool | ||||||
| 	WaitForJobs() bool | 	WaitForJobs() bool | ||||||
|  | @ -68,6 +69,7 @@ type SyncConfigProvider interface { | ||||||
| 
 | 
 | ||||||
| 	Values() []string | 	Values() []string | ||||||
| 	Set() []string | 	Set() []string | ||||||
|  | 	SkipCRDs() bool | ||||||
| 	SkipDeps() bool | 	SkipDeps() bool | ||||||
| 	Wait() bool | 	Wait() bool | ||||||
| 	WaitForJobs() bool | 	WaitForJobs() bool | ||||||
|  |  | ||||||
|  | @ -513,6 +513,10 @@ func (st *HelmState) prepareSyncReleases(helm helmexec.Interface, additionalValu | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
|  | 				if opts.SkipCRDs { | ||||||
|  | 					flags = append(flags, "--skip-crds") | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
| 				if opts.Wait { | 				if opts.Wait { | ||||||
| 					flags = append(flags, "--wait") | 					flags = append(flags, "--wait") | ||||||
| 				} | 				} | ||||||
|  | @ -595,6 +599,7 @@ func (st *HelmState) DetectReleasesToBeDeleted(helm helmexec.Interface, releases | ||||||
| type SyncOpts struct { | type SyncOpts struct { | ||||||
| 	Set         []string | 	Set         []string | ||||||
| 	SkipCleanup bool | 	SkipCleanup bool | ||||||
|  | 	SkipCRDs    bool | ||||||
| 	Wait        bool | 	Wait        bool | ||||||
| 	WaitForJobs bool | 	WaitForJobs bool | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue