mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-18 05:40:40 +02:00
feat: add support for helm 4 --server-side upgrade flag (#2641)
* feat: add support for helm 4 --server-side upgrade flag Add support for the helm 4 upgrade flag --server-side which accepts "true", "false", or "auto" (default "auto"). This allows users to explicitly control server-side apply behavior, which is needed for releases originally installed with Helm 3 and being managed with Helm 4. The flag can be configured via: - CLI: --server-side flag on sync, apply, and diff commands - helmDefaults.serverSide in helmfile.yaml - releases[].serverSide per-release override Precedence: release-level > CLI flag > helmDefaults. Errors are returned when serverSide is set but running Helm 3, or when an invalid value is provided. Closes #2640 Signed-off-by: yxxhero <aiopsclub@163.com> * test: update TestGenerateID expected hashes for new ServerSide field Adding ServerSide *string to ReleaseSpec changes spew's %#v output and shifts the FNV hash used by generateValuesID. Update the hard-coded want values to the new deterministic hashes. Signed-off-by: yxxhero <aiopsclub@163.com> --------- Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
@@ -1816,6 +1816,7 @@ func (a *App) apply(r *Run, c ApplyConfigProvider) (bool, bool, []error) {
|
||||
SkipSchemaValidation: c.SkipSchemaValidation(),
|
||||
SuppressOutputLineRegex: c.SuppressOutputLineRegex(),
|
||||
TakeOwnership: c.TakeOwnership(),
|
||||
ServerSide: c.ServerSide(),
|
||||
DetectedKubeVersion: detectedKubeVersion,
|
||||
}
|
||||
|
||||
@@ -1937,6 +1938,7 @@ Do you really want to apply?
|
||||
SyncArgs: c.SyncArgs(),
|
||||
HideNotes: c.HideNotes(),
|
||||
TakeOwnership: c.TakeOwnership(),
|
||||
ServerSide: c.ServerSide(),
|
||||
SyncReleaseLabels: c.SyncReleaseLabels(),
|
||||
TrackMode: c.TrackMode(),
|
||||
TrackTimeout: c.TrackTimeout(),
|
||||
@@ -2096,6 +2098,7 @@ func (a *App) diff(r *Run, c DiffConfigProvider) (*string, bool, bool, []error)
|
||||
SkipSchemaValidation: c.SkipSchemaValidation(),
|
||||
SuppressOutputLineRegex: c.SuppressOutputLineRegex(),
|
||||
TakeOwnership: c.TakeOwnership(),
|
||||
ServerSide: c.ServerSide(),
|
||||
DetectedKubeVersion: detectedKubeVersion,
|
||||
}
|
||||
|
||||
@@ -2335,6 +2338,7 @@ func (a *App) SyncState(r *Run, c SyncConfigProvider) (bool, bool, []error) {
|
||||
SkipSchemaValidation: diffC.SkipSchemaValidation(),
|
||||
SuppressOutputLineRegex: diffC.SuppressOutputLineRegex(),
|
||||
TakeOwnership: diffC.TakeOwnership(),
|
||||
ServerSide: diffC.ServerSide(),
|
||||
DetectedKubeVersion: detectedKubeVersion,
|
||||
}
|
||||
infoMsgPtr, _, _, diffErrs := r.diff(false, diffC.DetailedExitcode(), diffC, diffOpts)
|
||||
@@ -2422,6 +2426,7 @@ Do you really want to sync?
|
||||
SyncArgs: c.SyncArgs(),
|
||||
HideNotes: c.HideNotes(),
|
||||
TakeOwnership: c.TakeOwnership(),
|
||||
ServerSide: c.ServerSide(),
|
||||
SkipSchemaValidation: c.SkipSchemaValidation(),
|
||||
SyncReleaseLabels: c.SyncReleaseLabels(),
|
||||
TrackMode: c.TrackMode(),
|
||||
|
||||
@@ -2539,6 +2539,7 @@ type applyConfig struct {
|
||||
showOnly []string
|
||||
hideNotes bool
|
||||
takeOwnership bool
|
||||
serverSide string
|
||||
syncReleaseLabels bool
|
||||
enforceNeedsAreInstalled bool
|
||||
trackMode string
|
||||
@@ -2755,6 +2756,10 @@ func (a applyConfig) TakeOwnership() bool {
|
||||
return a.takeOwnership
|
||||
}
|
||||
|
||||
func (a applyConfig) ServerSide() string {
|
||||
return a.serverSide
|
||||
}
|
||||
|
||||
func (a applyConfig) SyncReleaseLabels() bool {
|
||||
return a.syncReleaseLabels
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ type ApplyConfigProvider interface {
|
||||
Cascade() string
|
||||
HideNotes() bool
|
||||
TakeOwnership() bool
|
||||
ServerSide() string
|
||||
SuppressOutputLineRegex() []string
|
||||
|
||||
Values() []string
|
||||
@@ -108,6 +109,7 @@ type SyncConfigProvider interface {
|
||||
PostRendererArgs() []string
|
||||
HideNotes() bool
|
||||
TakeOwnership() bool
|
||||
ServerSide() string
|
||||
Cascade() string
|
||||
|
||||
Values() []string
|
||||
@@ -176,6 +178,7 @@ type DiffConfigProvider interface {
|
||||
Context() int
|
||||
DiffOutput() string
|
||||
TakeOwnership() bool
|
||||
ServerSide() string
|
||||
|
||||
concurrencyConfig
|
||||
valuesControlMode
|
||||
|
||||
@@ -47,6 +47,7 @@ type diffConfig struct {
|
||||
reuseValues bool
|
||||
logger *zap.SugaredLogger
|
||||
takeOwnership bool
|
||||
serverSide string
|
||||
enforceNeedsAreInstalled bool
|
||||
}
|
||||
|
||||
@@ -188,6 +189,9 @@ func (a diffConfig) SuppressOutputLineRegex() []string {
|
||||
func (a diffConfig) TakeOwnership() bool {
|
||||
return a.takeOwnership
|
||||
}
|
||||
func (a diffConfig) ServerSide() string {
|
||||
return a.serverSide
|
||||
}
|
||||
|
||||
func (a diffConfig) EnforceNeedsAreInstalled() bool {
|
||||
return a.enforceNeedsAreInstalled
|
||||
|
||||
Reference in New Issue
Block a user