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