Add `--skip-crds` to `helmfile sync` and `helmfile apply` (#1771)

Resolves #1770
This commit is contained in:
Yusuke Kuoka 2021-04-11 10:38:23 +09:00 committed by GitHub
parent 589b26aaad
commit a111e89b27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 0 deletions

12
main.go
View File

@ -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")
}

View File

@ -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(),
}

View File

@ -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
}

View File

@ -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

View File

@ -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
}