diff --git a/main.go b/main.go index 97135e65..ed4185f3 100644 --- a/main.go +++ b/main.go @@ -378,6 +378,10 @@ func main() { Value: "", 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{ Name: "skip-deps", Usage: `skip running "helm repo update" and "helm dependency build"`, @@ -434,6 +438,10 @@ func main() { 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", }, + 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{ 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", @@ -815,6 +823,10 @@ func (c configImpl) SkipCleanup() bool { return c.c.Bool("skip-cleanup") } +func (c configImpl) SkipCRDs() bool { + return c.c.Bool("skip-crds") +} + func (c configImpl) SkipDiffOnInstall() bool { return c.c.Bool("skip-diff-on-install") } diff --git a/pkg/app/app.go b/pkg/app/app.go index 25f63e74..1012e140 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -1200,6 +1200,7 @@ Do you really want to apply? syncOpts := state.SyncOpts{ Set: c.Set(), SkipCleanup: c.RetainValuesFiles() || c.SkipCleanup(), + SkipCRDs: c.SkipCRDs(), Wait: c.Wait(), WaitForJobs: c.WaitForJobs(), } @@ -1595,6 +1596,7 @@ func (a *App) sync(r *Run, c SyncConfigProvider) (bool, []error) { opts := &state.SyncOpts{ Set: c.Set(), + SkipCRDs: c.SkipCRDs(), Wait: c.Wait(), WaitForJobs: c.WaitForJobs(), } diff --git a/pkg/app/app_test.go b/pkg/app/app_test.go index 213ae931..c0aef2d4 100644 --- a/pkg/app/app_test.go +++ b/pkg/app/app_test.go @@ -2243,6 +2243,7 @@ type configImpl struct { output string includeCRDs bool skipCleanup bool + skipCRDs bool skipDeps bool } @@ -2270,6 +2271,10 @@ func (c configImpl) SkipCleanup() bool { return c.skipCleanup } +func (c configImpl) SkipCRDs() bool { + return c.skipCRDs +} + func (c configImpl) SkipDeps() bool { return c.skipDeps } @@ -2305,6 +2310,7 @@ type applyConfig struct { set []string validate bool skipCleanup bool + skipCRDs bool skipDeps bool includeTests bool suppressSecrets bool @@ -2349,6 +2355,10 @@ func (a applyConfig) SkipCleanup() bool { return a.skipCleanup } +func (a applyConfig) SkipCRDs() bool { + return a.skipCRDs +} + func (a applyConfig) SkipDeps() bool { return a.skipDeps } diff --git a/pkg/app/config.go b/pkg/app/config.go index 2915432c..4517588c 100644 --- a/pkg/app/config.go +++ b/pkg/app/config.go @@ -39,6 +39,7 @@ type ApplyConfigProvider interface { Values() []string Set() []string + SkipCRDs() bool SkipDeps() bool Wait() bool WaitForJobs() bool @@ -68,6 +69,7 @@ type SyncConfigProvider interface { Values() []string Set() []string + SkipCRDs() bool SkipDeps() bool Wait() bool WaitForJobs() bool diff --git a/pkg/state/state.go b/pkg/state/state.go index fa347c10..480e3db7 100644 --- a/pkg/state/state.go +++ b/pkg/state/state.go @@ -513,6 +513,10 @@ func (st *HelmState) prepareSyncReleases(helm helmexec.Interface, additionalValu } } + if opts.SkipCRDs { + flags = append(flags, "--skip-crds") + } + if opts.Wait { flags = append(flags, "--wait") } @@ -595,6 +599,7 @@ func (st *HelmState) DetectReleasesToBeDeleted(helm helmexec.Interface, releases type SyncOpts struct { Set []string SkipCleanup bool + SkipCRDs bool Wait bool WaitForJobs bool }