From 6e8941054d2f38125aa89aab2640cb62c15f9a5b Mon Sep 17 00:00:00 2001 From: sealos-ci-robot <109538726+sealos-ci-robot@users.noreply.github.com> Date: Thu, 26 Oct 2023 14:38:37 +0800 Subject: [PATCH] refactor(main): skip success exec (#4162) (#4170) Co-authored-by: cuisongliu --- pkg/apply/applydrivers/apply_drivers_default.go | 2 +- pkg/types/v1beta1/cluster.go | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/pkg/apply/applydrivers/apply_drivers_default.go b/pkg/apply/applydrivers/apply_drivers_default.go index d334d960812..a00883e5872 100644 --- a/pkg/apply/applydrivers/apply_drivers_default.go +++ b/pkg/apply/applydrivers/apply_drivers_default.go @@ -166,7 +166,7 @@ func (c *Applier) updateStatus(clusterErr error, appErr error) { cmdCondition = v2.NewFailedCommandCondition(appErr.Error()) } } else if len(c.RunNewImages) > 0 { - cmdCondition = v2.NewSuccessCommandCondition() + return } cmdCondition.Images = c.RunNewImages c.ClusterDesired.Status.CommandConditions = v2.UpdateCommandCondition(c.ClusterDesired.Status.CommandConditions, cmdCondition) diff --git a/pkg/types/v1beta1/cluster.go b/pkg/types/v1beta1/cluster.go index 955a1a576ef..a9008c874f4 100644 --- a/pkg/types/v1beta1/cluster.go +++ b/pkg/types/v1beta1/cluster.go @@ -172,16 +172,6 @@ type CommandCondition struct { Message string `json:"message,omitempty"` } -func NewSuccessCommandCondition() CommandCondition { - return CommandCondition{ - Type: CommandConditionTypeSuccess, - Status: v1.ConditionTrue, - LastHeartbeatTime: metav1.Now(), - Reason: "Apply Command", - Message: "Applied to cluster successfully", - } -} - func NewFailedCommandCondition(message string) CommandCondition { return CommandCondition{ Type: CommandConditionTypeError,