From 94c80092d8b210bda314e23147604e181dc45b59 Mon Sep 17 00:00:00 2001 From: cuisongliu Date: Thu, 26 Oct 2023 10:30:30 +0800 Subject: [PATCH] refactor(main): skip success exec (#4162) --- 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 e620a419975..c9ea2601e32 100644 --- a/pkg/apply/applydrivers/apply_drivers_default.go +++ b/pkg/apply/applydrivers/apply_drivers_default.go @@ -171,7 +171,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 9b1137e24b9..af66dea26e5 100644 --- a/pkg/types/v1beta1/cluster.go +++ b/pkg/types/v1beta1/cluster.go @@ -187,16 +187,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,