Vendored
+1
@@ -55,6 +55,7 @@ type Config struct {
|
||||
Release string `` // Release argument to use in applicable helm commands
|
||||
Force bool `envconfig:"force_upgrade"` // Pass --force-replace to applicable helm commands
|
||||
ForceConflicts bool `split_words:"true"` // Pass --force-conflicts to `helm upgrade` (ДОБАВЛЕНО)
|
||||
ServerSideApply bool `split_words:"true"` // Pass --server-side to `helm upgrade` (ADD THIS LINE)
|
||||
AtomicUpgrade bool `split_words:"true"` // Pass --atomic to `helm upgrade`
|
||||
CleanupOnFail bool `envconfig:"cleanup_failed_upgrade"` // Pass --cleanup-on-fail to `helm upgrade`
|
||||
LintStrictly bool `split_words:"true"` // Pass --strict to `helm lint`
|
||||
|
||||
@@ -22,6 +22,7 @@ type Upgrade struct {
|
||||
timeout string
|
||||
force bool
|
||||
forceConflict bool
|
||||
serverSideApply bool
|
||||
atomic bool
|
||||
cleanupOnFail bool
|
||||
historyMax int
|
||||
@@ -47,7 +48,8 @@ func NewUpgrade(cfg env.Config) *Upgrade {
|
||||
reuseValues: cfg.ReuseValues,
|
||||
timeout: cfg.Timeout,
|
||||
force: cfg.Force,
|
||||
forceConflict: cfg.ForceConflicts, // FIXED: Added missing struct mapping
|
||||
forceConflict: cfg.ForceConflicts,
|
||||
serverSideApply: cfg.ServerSideApply,
|
||||
atomic: cfg.AtomicUpgrade,
|
||||
cleanupOnFail: cfg.CleanupOnFail,
|
||||
historyMax: cfg.HistoryMax,
|
||||
@@ -71,9 +73,9 @@ func (u *Upgrade) Prepare() error {
|
||||
return fmt.Errorf("release is required")
|
||||
}
|
||||
|
||||
// Validation: prevent generating invalid flags together
|
||||
if u.force && u.forceConflict {
|
||||
return fmt.Errorf("cannot use both 'force' (--force-replace) and 'force_conflicts' (--force-conflicts) together")
|
||||
// Safety check: Helm fails if both are passed
|
||||
if u.force && (u.serverSideApply || u.forceConflict) {
|
||||
return fmt.Errorf("cannot use 'force' (--force-replace) together with 'server_side_apply' or 'force_conflicts'")
|
||||
}
|
||||
|
||||
args := u.globalFlags()
|
||||
@@ -94,6 +96,9 @@ func (u *Upgrade) Prepare() error {
|
||||
if u.timeout != "" {
|
||||
args = append(args, "--timeout", u.timeout)
|
||||
}
|
||||
if u.serverSideApply {
|
||||
args = append(args, "--server-side")
|
||||
}
|
||||
if u.force {
|
||||
args = append(args, "--force-replace")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user