Files
helmfile/pkg/kubedog/options.go
T
yxxheroandCopilot c6e7249eb9 feat: add helm-legacy track mode for Helm v4 compatibility (#2466)
Add support for trackMode: helm-legacy to use Helm v4's --wait=legacy flag,
which maintains compatibility with Helm v3's wait behavior during migration.

Helm v4 changed the default --wait behavior from polling to a watcher-based
approach. This can cause issues with charts that have broken livenessProbe
configurations without startupProbe. The --wait=legacy flag preserves the
Helm v3 polling behavior for smoother migration.

Changes:
- Add TrackModeHelmLegacy constant in pkg/kubedog/options.go
- Use kubedog.TrackMode constants instead of raw strings in helmx.go
- Enhance appendWaitFlags to use --wait=legacy for Helm v4 when trackMode
  is helm-legacy
- Add nil check for logger before logging warning
- Add version check with warning when helm-legacy is used with Helm v3
- Update validation in pkg/config to accept helm-legacy track mode
- Update command-line flags in cmd/apply.go and cmd/sync.go
- Add comprehensive documentation in docs/advanced-features.md
- Add thorough test coverage including warning message verification

Behavior:
- Helm v4 + helm-legacy: Uses --wait=legacy
- Helm v3 + helm-legacy: Falls back to --wait with warning
- Helm v4 + helm: Uses --wait (watcher mode)
- Any + kubedog: Skips --wait flag

Fixes #2464

Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: Copilot <copilot@github.com>
2026-03-08 11:51:14 +08:00

59 lines
1.0 KiB
Go

package kubedog
import (
"time"
"github.com/helmfile/helmfile/pkg/resource"
)
type TrackMode string
const (
TrackModeHelm TrackMode = "helm"
TrackModeHelmLegacy TrackMode = "helm-legacy"
TrackModeKubedog TrackMode = "kubedog"
)
type TrackOptions struct {
Timeout time.Duration
Logs bool
LogsSince time.Duration
Filter *resource.FilterConfig
QPS float32
Burst int
}
func NewTrackOptions() *TrackOptions {
return &TrackOptions{
Timeout: 5 * time.Minute,
LogsSince: 10 * time.Minute,
QPS: 100,
Burst: 200,
}
}
func (o *TrackOptions) WithTimeout(timeout time.Duration) *TrackOptions {
o.Timeout = timeout
return o
}
func (o *TrackOptions) WithLogs(logs bool) *TrackOptions {
o.Logs = logs
return o
}
func (o *TrackOptions) WithFilterConfig(config *resource.FilterConfig) *TrackOptions {
o.Filter = config
return o
}
func (o *TrackOptions) WithQPS(qps float32) *TrackOptions {
o.QPS = qps
return o
}
func (o *TrackOptions) WithBurst(burst int) *TrackOptions {
o.Burst = burst
return o
}