mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-21 02:48:36 +02:00
Feat add cascade support (#860)
* feat: add cascade support for helm v3.12.0 Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
+3
-3
@@ -1441,7 +1441,7 @@ Do you really want to apply?
|
||||
|
||||
subst.Releases = rs
|
||||
|
||||
return subst.DeleteReleasesForSync(&affectedReleases, helm, c.Concurrency())
|
||||
return subst.DeleteReleasesForSync(&affectedReleases, helm, c.Concurrency(), c.Cascade())
|
||||
}))
|
||||
|
||||
if len(deletionErrs) > 0 {
|
||||
@@ -1560,7 +1560,7 @@ Do you really want to delete?
|
||||
|
||||
if len(releasesToDelete) > 0 {
|
||||
_, deletionErrs := withDAG(st, helm, a.Logger, state.PlanOptions{SelectedReleases: toDelete, Reverse: true, SkipNeeds: true}, a.WrapWithoutSelector(func(subst *state.HelmState, helm helmexec.Interface) []error {
|
||||
return subst.DeleteReleases(&affectedReleases, helm, c.Concurrency(), purge)
|
||||
return subst.DeleteReleases(&affectedReleases, helm, c.Concurrency(), purge, c.Cascade())
|
||||
}))
|
||||
|
||||
if len(deletionErrs) > 0 {
|
||||
@@ -1832,7 +1832,7 @@ Do you really want to sync?
|
||||
|
||||
subst.Releases = rs
|
||||
|
||||
return subst.DeleteReleasesForSync(&affectedReleases, helm, c.Concurrency())
|
||||
return subst.DeleteReleasesForSync(&affectedReleases, helm, c.Concurrency(), c.Cascade())
|
||||
}))
|
||||
|
||||
if len(deletionErrs) > 0 {
|
||||
|
||||
+8
-3
@@ -57,7 +57,7 @@ func expectNoCallsToHelmVersion(app *App) {
|
||||
}
|
||||
|
||||
app.helms = map[helmKey]helmexec.Interface{
|
||||
createHelmKey(app.OverrideHelmBinary, app.OverrideKubeContext): &versionOnlyHelmExec{isHelm3: true},
|
||||
createHelmKey(app.OverrideHelmBinary, app.OverrideKubeContext): testutil.NewV3HelmExec(true),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2185,8 +2185,9 @@ func (c configImpl) KubeVersion() string {
|
||||
}
|
||||
|
||||
type applyConfig struct {
|
||||
args string
|
||||
values []string
|
||||
args string
|
||||
cascade string
|
||||
values []string
|
||||
|
||||
// TODO: Remove this function once Helmfile v0.x
|
||||
retainValuesFiles bool
|
||||
@@ -2230,6 +2231,10 @@ func (a applyConfig) Args() string {
|
||||
return a.args
|
||||
}
|
||||
|
||||
func (a applyConfig) Cascade() string {
|
||||
return a.cascade
|
||||
}
|
||||
|
||||
func (a applyConfig) Wait() bool {
|
||||
return a.wait
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ type ReposConfigProvider interface {
|
||||
type ApplyConfigProvider interface {
|
||||
Args() string
|
||||
PostRenderer() string
|
||||
Cascade() string
|
||||
|
||||
Values() []string
|
||||
Set() []string
|
||||
@@ -88,6 +89,7 @@ type ApplyConfigProvider interface {
|
||||
type SyncConfigProvider interface {
|
||||
Args() string
|
||||
PostRenderer() string
|
||||
Cascade() string
|
||||
|
||||
Values() []string
|
||||
Set() []string
|
||||
@@ -144,6 +146,7 @@ type DiffConfigProvider interface {
|
||||
// TODO: Remove this function once Helmfile v0.x
|
||||
type DeleteConfigProvider interface {
|
||||
Args() string
|
||||
Cascade() string
|
||||
|
||||
Purge() bool
|
||||
SkipDeps() bool
|
||||
@@ -156,6 +159,7 @@ type DeleteConfigProvider interface {
|
||||
|
||||
type DestroyConfigProvider interface {
|
||||
Args() string
|
||||
Cascade() string
|
||||
|
||||
SkipDeps() bool
|
||||
SkipCharts() bool
|
||||
|
||||
@@ -34,6 +34,7 @@ func listFlags(namespace, kubeContext string) string {
|
||||
|
||||
type destroyConfig struct {
|
||||
args string
|
||||
cascade string
|
||||
concurrency int
|
||||
interactive bool
|
||||
skipDeps bool
|
||||
@@ -46,6 +47,10 @@ func (d destroyConfig) Args() string {
|
||||
return d.args
|
||||
}
|
||||
|
||||
func (d destroyConfig) Cascade() string {
|
||||
return d.cascade
|
||||
}
|
||||
|
||||
func (d destroyConfig) SkipCharts() bool {
|
||||
return d.skipCharts
|
||||
}
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"helm.sh/helm/v3/pkg/chart"
|
||||
|
||||
"github.com/helmfile/helmfile/pkg/helmexec"
|
||||
)
|
||||
|
||||
type noCallHelmExec struct {
|
||||
}
|
||||
|
||||
type versionOnlyHelmExec struct {
|
||||
*noCallHelmExec
|
||||
isHelm3 bool
|
||||
}
|
||||
|
||||
func (helm *versionOnlyHelmExec) IsHelm3() bool {
|
||||
return helm.isHelm3
|
||||
}
|
||||
|
||||
func (helm *noCallHelmExec) doPanic() {
|
||||
panic("unexpected call to helm")
|
||||
}
|
||||
|
||||
func (helm *noCallHelmExec) TemplateRelease(name, chart string, flags ...string) error {
|
||||
helm.doPanic()
|
||||
return nil
|
||||
}
|
||||
func (helm *noCallHelmExec) ChartPull(chart string, path string, flags ...string) error {
|
||||
helm.doPanic()
|
||||
return nil
|
||||
}
|
||||
func (helm *noCallHelmExec) ChartExport(chart string, path string, flags ...string) error {
|
||||
helm.doPanic()
|
||||
return nil
|
||||
}
|
||||
func (helm *noCallHelmExec) UpdateDeps(chart string) error {
|
||||
helm.doPanic()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (helm *noCallHelmExec) BuildDeps(name, chart string, flags ...string) error {
|
||||
helm.doPanic()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (helm *noCallHelmExec) SetExtraArgs(args ...string) {
|
||||
helm.doPanic()
|
||||
}
|
||||
func (helm *noCallHelmExec) SetHelmBinary(bin string) {
|
||||
helm.doPanic()
|
||||
}
|
||||
func (helm *noCallHelmExec) SetEnableLiveOutput(enableLiveOutput bool) {
|
||||
helm.doPanic()
|
||||
}
|
||||
func (helm *noCallHelmExec) SetDisableForceUpdate(forceUpdate bool) {
|
||||
helm.doPanic()
|
||||
}
|
||||
|
||||
func (helm *noCallHelmExec) AddRepo(name, repository, cafile, certfile, keyfile, username, password string, managed string, passCredentials string, skipTLSVerify string) error {
|
||||
helm.doPanic()
|
||||
return nil
|
||||
}
|
||||
func (helm *noCallHelmExec) UpdateRepo() error {
|
||||
helm.doPanic()
|
||||
return nil
|
||||
}
|
||||
func (helm *noCallHelmExec) RegistryLogin(name string, username string, password string) error {
|
||||
helm.doPanic()
|
||||
return nil
|
||||
}
|
||||
func (helm *noCallHelmExec) SyncRelease(context helmexec.HelmContext, name, chart string, flags ...string) error {
|
||||
helm.doPanic()
|
||||
return nil
|
||||
}
|
||||
func (helm *noCallHelmExec) DiffRelease(context helmexec.HelmContext, name, chart string, suppressDiff bool, flags ...string) error {
|
||||
helm.doPanic()
|
||||
return nil
|
||||
}
|
||||
func (helm *noCallHelmExec) ReleaseStatus(context helmexec.HelmContext, release string, flags ...string) error {
|
||||
helm.doPanic()
|
||||
return nil
|
||||
}
|
||||
func (helm *noCallHelmExec) DeleteRelease(context helmexec.HelmContext, name string, flags ...string) error {
|
||||
helm.doPanic()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (helm *noCallHelmExec) List(context helmexec.HelmContext, filter string, flags ...string) (string, error) {
|
||||
helm.doPanic()
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (helm *noCallHelmExec) DecryptSecret(context helmexec.HelmContext, name string, flags ...string) (string, error) {
|
||||
helm.doPanic()
|
||||
return "", nil
|
||||
}
|
||||
func (helm *noCallHelmExec) TestRelease(context helmexec.HelmContext, name string, flags ...string) error {
|
||||
helm.doPanic()
|
||||
return nil
|
||||
}
|
||||
func (helm *noCallHelmExec) Fetch(chart string, flags ...string) error {
|
||||
helm.doPanic()
|
||||
return nil
|
||||
}
|
||||
func (helm *noCallHelmExec) Lint(name, chart string, flags ...string) error {
|
||||
helm.doPanic()
|
||||
return nil
|
||||
}
|
||||
func (helm *noCallHelmExec) IsHelm3() bool {
|
||||
helm.doPanic()
|
||||
return false
|
||||
}
|
||||
|
||||
func (helm *noCallHelmExec) GetVersion() helmexec.Version {
|
||||
helm.doPanic()
|
||||
return helmexec.Version{}
|
||||
}
|
||||
|
||||
func (helm *noCallHelmExec) IsVersionAtLeast(versionStr string) bool {
|
||||
helm.doPanic()
|
||||
return false
|
||||
}
|
||||
|
||||
func (helm *noCallHelmExec) ShowChart(chartPath string) (chart.Metadata, error) {
|
||||
helm.doPanic()
|
||||
return chart.Metadata{}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user