diff --git a/cmd/apply.go b/cmd/apply.go index df369ff9..f1c6536f 100644 --- a/cmd/apply.go +++ b/cmd/apply.go @@ -42,8 +42,8 @@ func NewApplyCmd(globalCfg *config.GlobalImpl) *cobra.Command { f.BoolVar(&applyOptions.DetailedExitcode, "detailed-exitcode", false, "return a non-zero exit code 2 instead of 0 when there were changes detected AND the changes are synced successfully") f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm exec") if !runtime.V1Mode { + // TODO: Remove this function once Helmfile v0.x f.BoolVar(&applyOptions.RetainValuesFiles, "retain-values-files", false, "DEPRECATED: Use skip-cleanup instead") - // mark retain-values-files as deprecated, but keep it for backward compatibility, will be removed in the future _ = f.MarkDeprecated("retain-values-files", "Use skip-cleanup instead") } diff --git a/cmd/charts.go b/cmd/charts.go index 44c92207..1763f813 100644 --- a/cmd/charts.go +++ b/cmd/charts.go @@ -1,3 +1,4 @@ +// TODO: Remove this function once Helmfile v0.x package cmd import ( diff --git a/cmd/delete.go b/cmd/delete.go index 1329bcaa..c39c8890 100644 --- a/cmd/delete.go +++ b/cmd/delete.go @@ -1,3 +1,4 @@ +// TODO: Remove this function once Helmfile v0.x package cmd import ( diff --git a/cmd/root.go b/cmd/root.go index c3fd1d5b..b6c01a05 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -103,6 +103,7 @@ func NewRootCmd(globalConfig *config.GlobalOptions) (*cobra.Command, error) { ), ) + // TODO: Remove this function once Helmfile v0.x if !runtime.V1Mode { cmd.AddCommand( NewChartsCmd(globalImpl), diff --git a/pkg/app/app.go b/pkg/app/app.go index 82ce75de..0473dca5 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -132,6 +132,7 @@ func (a *App) Repos(c ReposConfigProvider) error { }, c.IncludeTransitiveNeeds(), SetFilter(true)) } +// TODO: Remove this function once Helmfile v0.x func (a *App) DeprecatedSyncCharts(c DeprecatedChartsConfigProvider) error { return a.ForEachState(func(run *Run) (_ bool, errs []error) { err := run.withPreparedCharts("charts", state.ChartPrepareOptions{ @@ -457,6 +458,7 @@ func (a *App) Status(c StatusesConfigProvider) error { }, false, SetFilter(true)) } +// TODO: Remove this function once Helmfile v0.x func (a *App) Delete(c DeleteConfigProvider) error { return a.ForEachState(func(run *Run) (ok bool, errs []error) { err := run.withPreparedCharts("delete", state.ChartPrepareOptions{ @@ -1166,6 +1168,8 @@ func (a *App) findDesiredStateFiles(specifiedPath string, opts LoadOpts) ([]stri var defaultFile string if a.fs.FileExistsAt(DefaultHelmfile) { defaultFile = DefaultHelmfile + + // TODO: Remove this function once Helmfile v0.x } else if a.fs.FileExistsAt(DeprecatedHelmfile) { log.Printf( "warn: %s is being loaded: %s is deprecated in favor of %s. See https://github.com/roboll/helmfile/issues/25 for more information", diff --git a/pkg/app/app_test.go b/pkg/app/app_test.go index 27a07cbd..ae0e8a67 100644 --- a/pkg/app/app_test.go +++ b/pkg/app/app_test.go @@ -2310,9 +2310,12 @@ func (c configImpl) PostRenderer() string { } type applyConfig struct { - args string - values []string - retainValuesFiles bool + args string + values []string + + // TODO: Remove this function once Helmfile v0.x + retainValuesFiles bool + set []string validate bool skipCleanup bool @@ -2450,6 +2453,7 @@ func (a applyConfig) Logger() *zap.SugaredLogger { return a.logger } +// TODO: Remove this function once Helmfile v0.x func (a applyConfig) RetainValuesFiles() bool { return a.retainValuesFiles } diff --git a/pkg/app/config.go b/pkg/app/config.go index 4bf17d72..9379d4e8 100644 --- a/pkg/app/config.go +++ b/pkg/app/config.go @@ -19,6 +19,7 @@ type ConfigProvider interface { loggingConfig } +// TODO: Remove this function once Helmfile v0.x type DeprecatedChartsConfigProvider interface { Values() []string @@ -66,7 +67,9 @@ type ApplyConfigProvider interface { Context() int DiffOutput() string + // TODO: Remove this function once Helmfile v0.x RetainValuesFiles() bool + Validate() bool SkipCleanup() bool SkipDiffOnInstall() bool @@ -133,6 +136,7 @@ type DiffConfigProvider interface { valuesControlMode } +// TODO: Remove this function once Helmfile v0.x type DeleteConfigProvider interface { Args() string diff --git a/pkg/app/constants.go b/pkg/app/constants.go index 38a75101..63fd3af7 100644 --- a/pkg/app/constants.go +++ b/pkg/app/constants.go @@ -8,8 +8,10 @@ import ( ) const ( - DefaultHelmfile = "helmfile.yaml" - DeprecatedHelmfile = "charts.yaml" + DefaultHelmfile = "helmfile.yaml" + // TODO: Remove this function once Helmfile v0.x + DeprecatedHelmfile = "charts.yaml" + DefaultHelmfileDirectory = "helmfile.d" ExperimentalSelectorExplicit = "explicit-selector-inheritance" // value to remove default selector inheritance to sub-helmfiles and use the explicit one ) diff --git a/pkg/app/run.go b/pkg/app/run.go index 8e349b16..af44ac7b 100644 --- a/pkg/app/run.go +++ b/pkg/app/run.go @@ -112,6 +112,7 @@ func (r *Run) Repos(c ReposConfigProvider) error { return r.ctx.SyncReposOnce(r.state, r.helm) } +// TODO: Remove this function once Helmfile v0.x func (r *Run) DeprecatedSyncCharts(c DeprecatedChartsConfigProvider) []error { st := r.state helm := r.helm diff --git a/pkg/config/apply.go b/pkg/config/apply.go index 47cdac34..4ab0296d 100644 --- a/pkg/config/apply.go +++ b/pkg/config/apply.go @@ -16,8 +16,11 @@ type ApplyOptions struct { Output string // DetailedExitcode is true if the exit code should be 2 instead of 0 if there were changes detected and the changes were synced successfully DetailedExitcode bool + + // TODO: Remove this function once Helmfile v0.x // DEPRECATED: Use skip-cleanup instead RetainValuesFiles bool + // SkipCleanup is true if the cleanup of temporary values files should be skipped SkipCleanup bool // SkipCRDs is true if the CRDs should be skipped @@ -113,6 +116,7 @@ func (a *ApplyImpl) IncludeTransitiveNeeds() bool { return a.ApplyOptions.IncludeTransitiveNeeds } +// TODO: Remove this function once Helmfile v0.x // RetainValuesFiles returns the retain values files. func (a *ApplyImpl) RetainValuesFiles() bool { return a.ApplyOptions.RetainValuesFiles diff --git a/pkg/config/charts.go b/pkg/config/charts.go index 00650beb..7319c5ac 100644 --- a/pkg/config/charts.go +++ b/pkg/config/charts.go @@ -1,3 +1,4 @@ +// TODO: Remove this function once Helmfile v0.x package config // ChartsOptions is the options for the build command diff --git a/pkg/config/delete.go b/pkg/config/delete.go index 5ef3be47..8b58a96a 100644 --- a/pkg/config/delete.go +++ b/pkg/config/delete.go @@ -1,3 +1,4 @@ +// TODO: Remove this function once Helmfile v0.x package config // DeleteOptions is the options for the build command diff --git a/pkg/state/create.go b/pkg/state/create.go index 6a8d9672..51074ce3 100644 --- a/pkg/state/create.go +++ b/pkg/state/create.go @@ -108,6 +108,7 @@ func (c *StateCreator) Parse(content []byte, baseDir, file string) (*HelmState, } } + // TODO: Remove this function once Helmfile v0.x if len(state.DeprecatedReleases) > 0 { if len(state.Releases) > 0 { return nil, fmt.Errorf("failed to parse %s: you can't specify both `charts` and `releases` sections", file) @@ -116,6 +117,7 @@ func (c *StateCreator) Parse(content []byte, baseDir, file string) (*HelmState, state.DeprecatedReleases = []ReleaseSpec{} } + // TODO: Remove this function once Helmfile v0.x if state.DeprecatedContext != "" && state.HelmDefaults.KubeContext == "" { state.HelmDefaults.KubeContext = state.DeprecatedContext } diff --git a/pkg/state/create_test.go b/pkg/state/create_test.go index d60fde85..5983766f 100644 --- a/pkg/state/create_test.go +++ b/pkg/state/create_test.go @@ -279,6 +279,7 @@ func TestReadFromYaml_StrictUnmarshalling(t *testing.T) { } } +// TODO: Remove this function once Helmfile v0.x func TestReadFromYaml_DeprecatedReleaseReferences(t *testing.T) { yamlFile := "example/path/to/yaml/file" yamlContent := []byte(`charts: diff --git a/pkg/state/state.go b/pkg/state/state.go index 8ef6fef2..68f7ad39 100644 --- a/pkg/state/state.go +++ b/pkg/state/state.go @@ -49,11 +49,14 @@ type ReleaseSetSpec struct { Environments map[string]EnvironmentSpec `yaml:"environments,omitempty"` - Bases []string `yaml:"bases,omitempty"` - HelmDefaults HelmSpec `yaml:"helmDefaults,omitempty"` - Helmfiles []SubHelmfileSpec `yaml:"helmfiles,omitempty"` - DeprecatedContext string `yaml:"context,omitempty"` - DeprecatedReleases []ReleaseSpec `yaml:"charts,omitempty"` + Bases []string `yaml:"bases,omitempty"` + HelmDefaults HelmSpec `yaml:"helmDefaults,omitempty"` + Helmfiles []SubHelmfileSpec `yaml:"helmfiles,omitempty"` + + // TODO: Remove this function once Helmfile v0.x + DeprecatedContext string `yaml:"context,omitempty"` + DeprecatedReleases []ReleaseSpec `yaml:"charts,omitempty"` + OverrideKubeContext string `yaml:"kubeContext,omitempty"` OverrideNamespace string `yaml:"namespace,omitempty"` OverrideChart string `yaml:"chart,omitempty"` diff --git a/pkg/state/state_test.go b/pkg/state/state_test.go index 76fe931b..9326c490 100644 --- a/pkg/state/state_test.go +++ b/pkg/state/state_test.go @@ -54,12 +54,15 @@ func TestLabelParsing(t *testing.T) { func TestHelmState_applyDefaultsTo(t *testing.T) { type fields struct { - BaseChartPath string - Context string + BaseChartPath string + Context string + + // TODO: Remove this function once Helmfile v0.x DeprecatedReleases []ReleaseSpec - Namespace string - Repositories []RepositorySpec - Releases []ReleaseSpec + + Namespace string + Repositories []RepositorySpec + Releases []ReleaseSpec } type args struct { spec ReleaseSpec @@ -82,11 +85,14 @@ func TestHelmState_applyDefaultsTo(t *testing.T) { specWithNamespaceFromFields.Namespace = "test-namespace-field" fieldsWithNamespace := fields{ - BaseChartPath: ".", - Context: "test_context", + BaseChartPath: ".", + Context: "test_context", + + // TODO: Remove this function once Helmfile v0.x DeprecatedReleases: nil, - Namespace: specWithNamespaceFromFields.Namespace, - Repositories: nil, + + Namespace: specWithNamespaceFromFields.Namespace, + Repositories: nil, Releases: []ReleaseSpec{ specWithNamespace, }, @@ -140,11 +146,13 @@ func TestHelmState_applyDefaultsTo(t *testing.T) { state := &HelmState{ basePath: tt.fields.BaseChartPath, ReleaseSetSpec: ReleaseSetSpec{ + // TODO: Remove this function once Helmfile v0.x DeprecatedContext: tt.fields.Context, DeprecatedReleases: tt.fields.DeprecatedReleases, - OverrideNamespace: tt.fields.Namespace, - Repositories: tt.fields.Repositories, - Releases: tt.fields.Releases, + + OverrideNamespace: tt.fields.Namespace, + Repositories: tt.fields.Repositories, + Releases: tt.fields.Releases, }, } if state.ApplyOverrides(&tt.args.spec); !reflect.DeepEqual(tt.args.spec, tt.want) { @@ -768,9 +776,11 @@ func TestHelmState_flagsForUpgrade(t *testing.T) { state := &HelmState{ basePath: "./", ReleaseSetSpec: ReleaseSetSpec{ + // TODO: Remove this function once Helmfile v0.x DeprecatedContext: "default", - Releases: []ReleaseSpec{*tt.release}, - HelmDefaults: tt.defaults, + + Releases: []ReleaseSpec{*tt.release}, + HelmDefaults: tt.defaults, }, valsRuntime: valsRuntime, }